Skip to content

Commit

Permalink
Fixing failing doctests, revert hiding _one_* method.
Browse files Browse the repository at this point in the history
  • Loading branch information
tscrim committed Aug 19, 2023
1 parent 5a0232b commit be1d7c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/sage/categories/algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,8 @@ def extra_super_categories(self):
sage: C.extra_super_categories()
[Category of algebras over Rational Field]
sage: sorted(C.super_categories(), key=str)
[Category of Cartesian products of distributive magmas and additive magmas,
Category of Cartesian products of monoids,
Category of Cartesian products of vector spaces over Rational Field,
[Category of Cartesian products of monoids,
Category of Cartesian products of unital algebras over Rational Field,
Category of algebras over Rational Field]
"""
return [self.base_category()]
Expand Down
6 changes: 3 additions & 3 deletions src/sage/categories/algebras_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def extra_super_categories(self):

class ParentMethods:
@cached_method
def _one_from_cartesian_product_of_one_basis(self):
def one_from_cartesian_product_of_one_basis(self):
"""
Return the one of this Cartesian product of algebras, as per
``Monoids.ParentMethods.one``
Expand All @@ -249,7 +249,7 @@ def _one_from_cartesian_product_of_one_basis(self):
word:
sage: B = cartesian_product((A, A, A)) # optional - sage.combinat
sage: B.one_from_cartesian_product_of_one_basis() # optional - sage.combinat
sage: B.one_from_cartesian_product_of_one_basis() # optional - sage.combinat
B[(0, word: )] + B[(1, word: )] + B[(2, word: )]
sage: B.one() # optional - sage.combinat
B[(0, word: )] + B[(1, word: )] + B[(2, word: )]
Expand All @@ -273,7 +273,7 @@ def one(self):
B[(0, word: )] + B[(1, word: )] + B[(2, word: )]
"""
if all(hasattr(module, "one_basis") and module.one_basis is not NotImplemented for module in self._sets):
return self._one_from_cartesian_product_of_one_basis
return self.one_from_cartesian_product_of_one_basis
return self._one_generic

_one_generic = UnitalAlgebras.CartesianProducts.ParentMethods.one
Expand Down
10 changes: 5 additions & 5 deletions src/sage/categories/unital_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,12 @@ def extra_super_categories(self):
sage: from sage.categories.unital_algebras import UnitalAlgebras
sage: C = UnitalAlgebras(QQ).CartesianProducts()
sage: C.extra_super_categories()
[Category of algebras over Rational Field]
[Category of unital algebras over Rational Field]
sage: sorted(C.super_categories(), key=str)
[Category of Cartesian products of distributive magmas and additive magmas,
Category of Cartesian products of monoids,
Category of Cartesian products of unital magmas,
Category of Cartesian products of vector spaces over Rational Field,
Category of algebras over Rational Field]
Category of unital algebras over Rational Field]
"""
return [self.base_category()]

Expand All @@ -428,5 +428,5 @@ def one(self):
sage: all(b == b * one for b in C.basis())
True
"""
return self.sum(self.cartesian_embedding(i)(C.one())
for i, C in enumerate(self.cartesian_factors()))
data = enumerate(self.cartesian_factors())
return self._cartesian_product_of_elements([C.one() for i, C in data])

0 comments on commit be1d7c3

Please sign in to comment.