Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac 15801: reinstated test in vector spaces after some mess up in th…
Browse files Browse the repository at this point in the history
…e #10963 branch; updated some doctests
  • Loading branch information
nthiery committed Apr 11, 2014
1 parent 545765a commit 961bfb6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/sage/categories/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class Modules(Category_module):
Category of vector spaces over Rational Field
sage: Modules(Rings())
Category of modules over Category of rings
Category of modules over rings
sage: Modules(FiniteFields())
Category of vector spaces over Category of finite fields
Category of vector spaces over finite fields
sage: Modules(Integers(9))
Category of modules over Ring of integers modulo 9
Expand Down
8 changes: 5 additions & 3 deletions src/sage/categories/vector_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __classcall_private__(cls, K, check=True):
sage: VectorSpaces(ZZ)
Traceback (most recent call last):
...
AssertionError: The base ring must be a field.
ValueError: base must be a field or a subcategory of Fields(); got Integer Ring
With ``check=False``, the check is disabled, possibly enabling
incorrect inputs::
Expand All @@ -58,7 +58,9 @@ def __classcall_private__(cls, K, check=True):
Category of vector spaces over Integer Ring
"""
if check:
assert K in _Fields, "The base ring must be a field."
if not (K in _Fields or
isinstance(K, Category) and K.is_subcategory(_Fields)):
raise ValueError, "base must be a field or a subcategory of Fields(); got %s"%K
return super(VectorSpaces, cls).__classcall__(cls, K)

def __init__(self, K):
Expand All @@ -70,7 +72,7 @@ def __init__(self, K):
sage: VectorSpaces(ZZ)
Traceback (most recent call last):
...
AssertionError: The base ring must be a field.
ValueError: base must be a field or a subcategory of Fields(); got Integer Ring
TESTS::
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/polynomial/polynomial_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ def __init__(self, base_ring, name=None, sparse=False, element_class=None, categ
x^3 - 26/3*x^2 + 64/3*x - 32/3
sage: category(ZZ['x'])
Join of Category of unique factorization domains and Category of commutative algebras over Category of euclidean domains
Join of Category of unique factorization domains and Category of commutative algebras over euclidean domains
sage: category(GF(7)['x'])
Join of Category of euclidean domains and Category of commutative algebras over Join of Category of finite fields and Category of subquotients of monoids and Category of quotients of semigroups
Join of Category of euclidean domains and Category of commutative algebras over (finite fields and subquotients of monoids and quotients of semigroups)
"""
# We trust that, if category is given, it is useful and does not need to be joined
# with the default category
Expand Down

0 comments on commit 961bfb6

Please sign in to comment.