From 92088d32521fca1dc70c078c44514e1353fcfaf7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 8 Oct 2023 13:09:38 -0700 Subject: [PATCH 1/2] py312: fix AttributeError doctests (sed changes) In python 3.12, attribute errors add a suggestion at the end of the usual error message ("Did you mean ...?"). We add ... at the end of these doctest outputs to fix it. This commit has the bulk of the changes, obtained with: git grep -l "AttributeError:" src | xargs sed -ie \ 's/^ *\(AttributeError: .*\)\?has no attribute.*$/&.../' --- .../coercion_and_categories.rst | 2 +- .../tutorial-objects-and-classes.rst | 4 +-- src/sage/algebras/cluster_algebra.py | 2 +- .../weyl_lie_conformal_algebra.py | 2 +- .../algebras/steenrod/steenrod_algebra.py | 2 +- src/sage/categories/category.py | 2 +- src/sage/categories/category_with_axiom.py | 4 +-- src/sage/categories/enumerated_sets.py | 6 ++-- src/sage/categories/examples/sets_cat.py | 2 +- src/sage/categories/homset.py | 2 +- src/sage/categories/modules_with_basis.py | 2 +- src/sage/categories/monoids.py | 2 +- src/sage/combinat/finite_state_machine.py | 2 +- src/sage/combinat/growth.py | 2 +- src/sage/combinat/integer_lists/lists.py | 2 +- src/sage/combinat/posets/posets.py | 2 +- src/sage/cpython/debug.pyx | 2 +- src/sage/cpython/getattr.pyx | 22 +++++++------- src/sage/crypto/classical.py | 8 ++--- .../crypto/mq/mpolynomialsystemgenerator.py | 2 +- src/sage/data_structures/bitset.pyx | 8 ++--- src/sage/doctest/reporting.py | 2 +- src/sage/dynamics/finite_dynamical_system.py | 4 +-- src/sage/geometry/cone.py | 2 +- src/sage/geometry/fan.py | 2 +- .../face_iterator.pyx | 2 +- src/sage/geometry/toric_plotter.py | 2 +- .../groups/matrix_gps/finitely_generated.py | 2 +- src/sage/homology/chains.py | 10 +++---- src/sage/homology/free_resolution.py | 2 +- src/sage/interfaces/magma.py | 2 +- src/sage/libs/gap/element.pyx | 2 +- src/sage/manifolds/calculus_method.py | 2 +- .../differentiable/vectorfield_module.py | 2 +- src/sage/matrix/matrix2.pyx | 2 +- src/sage/matrix/matrix_cyclo_dense.pyx | 2 +- src/sage/matrix/matrix_gfpn_dense.pyx | 2 +- src/sage/matrix/matrix_space.py | 2 +- src/sage/matroids/linear_matroid.pyx | 2 +- src/sage/misc/functional.py | 2 +- src/sage/misc/instancedoc.pyx | 2 +- src/sage/misc/lazy_attribute.pyx | 14 ++++----- src/sage/misc/object_multiplexer.py | 2 +- src/sage/misc/sage_input.py | 4 +-- src/sage/modules/fp_graded/steenrod/module.py | 2 +- src/sage/parallel/map_reduce.py | 2 +- src/sage/plot/colors.py | 4 +-- src/sage/rings/asymptotic/asymptotic_ring.py | 2 +- src/sage/rings/asymptotic/growth_group.py | 2 +- src/sage/rings/ideal.py | 2 +- src/sage/rings/number_field/number_field.py | 8 ++--- src/sage/rings/padics/generic_nodes.py | 2 +- .../rings/polynomial/polynomial_element.pyx | 4 +-- .../polynomial/polynomial_quotient_ring.py | 2 +- src/sage/rings/ring.pyx | 2 +- src/sage/schemes/toric/morphism.py | 2 +- .../sets/disjoint_union_enumerated_sets.py | 2 +- src/sage/sets/set.py | 2 +- src/sage/structure/category_object.pyx | 2 +- src/sage/structure/element.pyx | 30 +++++++++---------- src/sage/structure/sequence.py | 4 +-- src/sage/symbolic/pynac_impl.pxi | 2 +- 62 files changed, 114 insertions(+), 114 deletions(-) diff --git a/src/doc/en/thematic_tutorials/coercion_and_categories.rst b/src/doc/en/thematic_tutorials/coercion_and_categories.rst index bb23331c151..7f5712caea7 100644 --- a/src/doc/en/thematic_tutorials/coercion_and_categories.rst +++ b/src/doc/en/thematic_tutorials/coercion_and_categories.rst @@ -1223,7 +1223,7 @@ However, only "elementary" construction functors have a rank:: sage: (Fract*Poly).rank Traceback (most recent call last): ... - AttributeError: 'CompositeConstructionFunctor' object has no attribute 'rank' + AttributeError: 'CompositeConstructionFunctor' object has no attribute 'rank'... .. end of output diff --git a/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst b/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst index 553a946c4d8..3cd71a9bad4 100644 --- a/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst +++ b/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst @@ -318,7 +318,7 @@ http://docs.python.org/library/ for a complete list. :: sage: e.__dict__ Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute '__dict__' + AttributeError: 'sage.rings.integer.Integer' object has no attribute '__dict__'... sage: id4 = SymmetricGroup(4).one() sage: type(id4) @@ -326,7 +326,7 @@ http://docs.python.org/library/ for a complete list. :: sage: id4.__dict__ Traceback (most recent call last): ... - AttributeError: 'sage.groups.perm_gps.permgroup_element.SymmetricGroupElement' object has no attribute '__dict__' + AttributeError: 'sage.groups.perm_gps.permgroup_element.SymmetricGroupElement' object has no attribute '__dict__'... .. note:: diff --git a/src/sage/algebras/cluster_algebra.py b/src/sage/algebras/cluster_algebra.py index b72d2a12976..14669dfed5c 100644 --- a/src/sage/algebras/cluster_algebra.py +++ b/src/sage/algebras/cluster_algebra.py @@ -167,7 +167,7 @@ sage: (t*s).g_vector() Traceback (most recent call last): ... - AttributeError: 'ClusterAlgebra_with_category.element_class' object has no attribute 'g_vector' + AttributeError: 'ClusterAlgebra_with_category.element_class' object has no attribute 'g_vector'... sage: A = ClusterAlgebra(['A', 2], principal_coefficients=True) sage: A.explore_to_depth(infinity) sage: s = A.cluster_variable((0, -1)); s diff --git a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py index e4a91723558..343ee8a66f9 100644 --- a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py @@ -109,7 +109,7 @@ class WeylLieConformalAlgebra(LieConformalAlgebraWithStructureCoefficients): sage: alpha0.degree() Traceback (most recent call last): ... - AttributeError: 'WeylLieConformalAlgebra_with_category.element_class' object has no attribute 'degree' + AttributeError: 'WeylLieConformalAlgebra_with_category.element_class' object has no attribute 'degree'... TESTS:: diff --git a/src/sage/algebras/steenrod/steenrod_algebra.py b/src/sage/algebras/steenrod/steenrod_algebra.py index 978a3557a9d..7c4d444f81c 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra.py +++ b/src/sage/algebras/steenrod/steenrod_algebra.py @@ -1080,7 +1080,7 @@ def homogeneous_component(self, n): sage: a.antipode() # not defined Traceback (most recent call last): ... - AttributeError: 'CombinatorialFreeModule_with_category.element_class' object has no attribute 'antipode' + AttributeError: 'CombinatorialFreeModule_with_category.element_class' object has no attribute 'antipode'... sage: A(a).antipode() # convert to elt of A, then compute antipode Sq(2,1) + Sq(5) diff --git a/src/sage/categories/category.py b/src/sage/categories/category.py index 57ef7f4184b..29bce8ee415 100644 --- a/src/sage/categories/category.py +++ b/src/sage/categories/category.py @@ -2129,7 +2129,7 @@ def _with_axioms(self, axioms): sage: Semigroups().Inverse() Traceback (most recent call last): ... - AttributeError: 'Semigroups_with_category' object has no attribute 'Inverse' + AttributeError: 'Semigroups_with_category' object has no attribute 'Inverse'... sage: Semigroups()._with_axioms(["Inverse"]) Category of semigroups diff --git a/src/sage/categories/category_with_axiom.py b/src/sage/categories/category_with_axiom.py index 5227792e725..4775d4e5bf1 100644 --- a/src/sage/categories/category_with_axiom.py +++ b/src/sage/categories/category_with_axiom.py @@ -554,7 +554,7 @@ class from the base category class:: sage: Magmas.Unital.Associative Traceback (most recent call last): ... - AttributeError: type object 'Magmas.Unital' has no attribute 'Associative' + AttributeError: type object 'Magmas.Unital' has no attribute 'Associative'... The purpose of this section is to explain the design of the code layout and the rationale for this mismatch. @@ -769,7 +769,7 @@ def _(): return LazyImport('sage.categories.rngs', 'Rngs', at_startup=True) sage: Semirings().NoZeroDivisors() Traceback (most recent call last): ... - AttributeError: 'Semirings_with_category' object has no attribute 'NoZeroDivisors' + AttributeError: 'Semirings_with_category' object has no attribute 'NoZeroDivisors'... Concretely, this is to be implemented by defining the new axiom in the (``SubcategoryMethods`` nested class of the) appropriate category with diff --git a/src/sage/categories/enumerated_sets.py b/src/sage/categories/enumerated_sets.py index a8bea53f907..b0ea05d0563 100644 --- a/src/sage/categories/enumerated_sets.py +++ b/src/sage/categories/enumerated_sets.py @@ -610,7 +610,7 @@ def _list_from_iterator(self): sage: (QQ^2).list() # indirect test # needs sage.modules Traceback (most recent call last): ... - AttributeError: 'FreeModule_ambient_field_with_category' object has no attribute 'list' + AttributeError: 'FreeModule_ambient_field_with_category' object has no attribute 'list'... Here we test that for an object that does not know whether it is finite or not. Calling ``x.list()`` simply tries to create @@ -622,11 +622,11 @@ def _list_from_iterator(self): sage: Q.is_finite() Traceback (most recent call last): ... - AttributeError: 'QuotientRing_generic_with_category' object has no attribute 'is_finite' + AttributeError: 'QuotientRing_generic_with_category' object has no attribute 'is_finite'... sage: Q.list() # indirect test Traceback (most recent call last): ... - AttributeError: 'QuotientRing_generic_with_category' object has no attribute 'list' + AttributeError: 'QuotientRing_generic_with_category' object has no attribute 'list'... Here is another example. We artificially create a version of the ring of integers that does not know whether it is finite diff --git a/src/sage/categories/examples/sets_cat.py b/src/sage/categories/examples/sets_cat.py index e0853d63f94..fbadb9ca405 100644 --- a/src/sage/categories/examples/sets_cat.py +++ b/src/sage/categories/examples/sets_cat.py @@ -619,7 +619,7 @@ class PrimeNumbers_Facade(PrimeNumbers_Abstract): sage: pf.next() Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute 'next' + AttributeError: 'sage.rings.integer.Integer' object has no attribute 'next'... unlike in the other implementations:: diff --git a/src/sage/categories/homset.py b/src/sage/categories/homset.py index 22ba9d047fc..2a8b8aeedeb 100644 --- a/src/sage/categories/homset.py +++ b/src/sage/categories/homset.py @@ -632,7 +632,7 @@ def __init__(self, X, Y, category=None, base=None, check=True): sage: H = MyHomset(X, Y, category=1, base = ZZ, check = False) Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute 'Homsets' + AttributeError: 'sage.rings.integer.Integer' object has no attribute 'Homsets'... sage: P. = ZZ[] sage: f = P.hom([1/2*t]) sage: f.parent().domain() diff --git a/src/sage/categories/modules_with_basis.py b/src/sage/categories/modules_with_basis.py index e97bf851388..c4933d0657f 100644 --- a/src/sage/categories/modules_with_basis.py +++ b/src/sage/categories/modules_with_basis.py @@ -2456,7 +2456,7 @@ def apply_multilinear_morphism(self, f, codomain=None): sage: tensor([a, b]).apply_multilinear_morphism(f) # needs sage.modules Traceback (most recent call last): ... - AttributeError: 'int' object has no attribute 'parent' + AttributeError: 'int' object has no attribute 'parent'... Here we consider an example where the codomain is a module with basis with a different base ring:: diff --git a/src/sage/categories/monoids.py b/src/sage/categories/monoids.py index 38dd7248c9d..28474bd17b6 100644 --- a/src/sage/categories/monoids.py +++ b/src/sage/categories/monoids.py @@ -556,7 +556,7 @@ def algebra_generators(self): Traceback (most recent call last): ... AttributeError: 'IntegerModMonoid_with_category' object - has no attribute 'monoid_generators' + has no attribute 'monoid_generators'... sage: Z12.semigroup_generators() Family (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) sage: Z12.algebra(QQ).algebra_generators() # needs sage.modules diff --git a/src/sage/combinat/finite_state_machine.py b/src/sage/combinat/finite_state_machine.py index 9a1d4bb892c..acd0adb2718 100644 --- a/src/sage/combinat/finite_state_machine.py +++ b/src/sage/combinat/finite_state_machine.py @@ -1835,7 +1835,7 @@ def __getstate__(self): sage: T1.transitions Traceback (most recent call last): ... - AttributeError: 'FSMState' object has no attribute 'transitions' + AttributeError: 'FSMState' object has no attribute 'transitions'... sage: A1 = loads(dumps(A)) sage: all(A.state(j) == A1.state(j) for j in [0, 1]) True diff --git a/src/sage/combinat/growth.py b/src/sage/combinat/growth.py index 86d5070a590..23b7a279fdc 100644 --- a/src/sage/combinat/growth.py +++ b/src/sage/combinat/growth.py @@ -371,7 +371,7 @@ sage: GrowthDiagram(RulePascal(), [3,1,2]) Traceback (most recent call last): ... - AttributeError: 'RulePascal' object has no attribute 'forward_rule' + AttributeError: 'RulePascal' object has no attribute 'forward_rule'... We now re-implement the rule where we provide the dual graded graphs:: diff --git a/src/sage/combinat/integer_lists/lists.py b/src/sage/combinat/integer_lists/lists.py index 5143e5cb5e8..9117a6076f7 100644 --- a/src/sage/combinat/integer_lists/lists.py +++ b/src/sage/combinat/integer_lists/lists.py @@ -261,7 +261,7 @@ def __getattr__(self, name): sage: L.foo Traceback (most recent call last): ... - AttributeError: 'NoneType' object has no attribute 'foo' + AttributeError: 'NoneType' object has no attribute 'foo'... """ return getattr(self.backend, name) diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index 0963c2b9d31..d3c46a1daf7 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -8825,7 +8825,7 @@ def is_induced_subposet(self, other): sage: Poset().is_induced_subposet('junk') Traceback (most recent call last): ... - AttributeError: 'str' object has no attribute 'subposet' + AttributeError: 'str' object has no attribute 'subposet'... """ if (not self._is_facade or (isinstance(other, FinitePoset) and not other._is_facade)): diff --git a/src/sage/cpython/debug.pyx b/src/sage/cpython/debug.pyx index 986abff2a99..022d8e1fed7 100644 --- a/src/sage/cpython/debug.pyx +++ b/src/sage/cpython/debug.pyx @@ -123,7 +123,7 @@ def getattr_debug(obj, name, default=_no_default): sage: _ = getattr_debug(1, "foo") Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute 'foo' + AttributeError: 'sage.rings.integer.Integer' object has no attribute 'foo'... sage: _ = getattr_debug(1, "foo", "xyz") getattr_debug(obj=1, name='foo'): type(obj) = diff --git a/src/sage/cpython/getattr.pyx b/src/sage/cpython/getattr.pyx index 52afed49d64..1f49e5230c3 100644 --- a/src/sage/cpython/getattr.pyx +++ b/src/sage/cpython/getattr.pyx @@ -53,12 +53,12 @@ cdef class AttributeErrorMessage: sage: 1.bla #indirect doctest Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute 'bla' + AttributeError: 'sage.rings.integer.Integer' object has no attribute 'bla'... sage: x = polygen(ZZ, 'x') sage: QQ[x].gen().bla # needs sage.libs.flint Traceback (most recent call last): ... - AttributeError: 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint' object has no attribute 'bla' + AttributeError: 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint' object has no attribute 'bla'... :: @@ -144,7 +144,7 @@ cpdef raw_getattr(obj, name): sage: raw_getattr(X, "attr") Traceback (most recent call last): ... - AttributeError: '...' object has no attribute 'attr' + AttributeError: '...' object has no attribute 'attr'... sage: x = X() sage: raw_getattr(x, "prop") @@ -173,7 +173,7 @@ cpdef raw_getattr(obj, name): sage: raw_getattr(Y, "attr") Traceback (most recent call last): ... - AttributeError: '...' object has no attribute 'attr' + AttributeError: '...' object has no attribute 'attr'... sage: y = Y() sage: raw_getattr(y, "prop") @@ -278,7 +278,7 @@ cpdef getattr_from_other_class(self, cls, name): sage: getattr_from_other_class(1, A, "lazy_attribute") Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute 'lazy_attribute' + AttributeError: 'sage.rings.integer.Integer' object has no attribute 'lazy_attribute'... The integer ring is a parent, so, lazy attributes work:: @@ -289,7 +289,7 @@ cpdef getattr_from_other_class(self, cls, name): sage: getattr_from_other_class(17, A, "lazy_attribute") Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute 'lazy_attribute' + AttributeError: 'sage.rings.integer.Integer' object has no attribute 'lazy_attribute'... In general, descriptors are not yet well supported, because they often do not accept to be cheated with the type of their instance:: @@ -305,7 +305,7 @@ cpdef getattr_from_other_class(self, cls, name): sage: getattr_from_other_class(1, A, "__weakref__") Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute '__weakref__' + AttributeError: 'sage.rings.integer.Integer' object has no attribute '__weakref__'... This was caught by :trac:`8296` for which we do a couple more tests:: @@ -314,7 +314,7 @@ cpdef getattr_from_other_class(self, cls, name): sage: 1.__weakref__ Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute '__weakref__' + AttributeError: 'sage.rings.integer.Integer' object has no attribute '__weakref__'... sage: n = 1 sage: ip = get_ipython() # not tested: only works in interactive shell @@ -329,7 +329,7 @@ cpdef getattr_from_other_class(self, cls, name): sage: getattr_from_other_class(1, A, "__call__") Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute '__call__' + AttributeError: 'sage.rings.integer.Integer' object has no attribute '__call__'... TESTS: @@ -339,14 +339,14 @@ cpdef getattr_from_other_class(self, cls, name): sage: getattr_from_other_class(1, type, "__name__") Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute '__name__' + AttributeError: 'sage.rings.integer.Integer' object has no attribute '__name__'... Non-strings as "name" are handled gracefully:: sage: getattr_from_other_class(1, type, None) Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute None + AttributeError: 'sage.rings.integer.Integer' object has no attribute None... """ if not isinstance(cls, type): raise TypeError(f"{cls!r} is not a type") diff --git a/src/sage/crypto/classical.py b/src/sage/crypto/classical.py index e5da119086a..e88ad4924bb 100644 --- a/src/sage/crypto/classical.py +++ b/src/sage/crypto/classical.py @@ -494,7 +494,7 @@ def rank_by_chi_square(self, C, pdict): sage: A.rank_by_chi_square("", Plist) Traceback (most recent call last): ... - AttributeError: 'str' object has no attribute 'parent' + AttributeError: 'str' object has no attribute 'parent'... sage: A.rank_by_chi_square(A.encoding(""), Plist) Traceback (most recent call last): ... @@ -703,7 +703,7 @@ def rank_by_squared_differences(self, C, pdict): sage: A.rank_by_squared_differences("", Plist) Traceback (most recent call last): ... - AttributeError: 'str' object has no attribute 'parent' + AttributeError: 'str' object has no attribute 'parent'... sage: A.rank_by_squared_differences(A.encoding(""), Plist) Traceback (most recent call last): ... @@ -2114,7 +2114,7 @@ def rank_by_chi_square(self, C, pdict): sage: S.rank_by_chi_square("", Pdict) Traceback (most recent call last): ... - AttributeError: 'str' object has no attribute 'parent' + AttributeError: 'str' object has no attribute 'parent'... sage: S.rank_by_chi_square(S.encoding(""), Pdict) Traceback (most recent call last): ... @@ -2351,7 +2351,7 @@ def rank_by_squared_differences(self, C, pdict): sage: S.rank_by_squared_differences("", Pdict) Traceback (most recent call last): ... - AttributeError: 'str' object has no attribute 'parent' + AttributeError: 'str' object has no attribute 'parent'... sage: S.rank_by_squared_differences(S.encoding(""), Pdict) Traceback (most recent call last): ... diff --git a/src/sage/crypto/mq/mpolynomialsystemgenerator.py b/src/sage/crypto/mq/mpolynomialsystemgenerator.py index 9028dab1d98..4416d9ef7f6 100644 --- a/src/sage/crypto/mq/mpolynomialsystemgenerator.py +++ b/src/sage/crypto/mq/mpolynomialsystemgenerator.py @@ -156,7 +156,7 @@ def sbox(self): sage: msg.sbox() Traceback (most recent call last): ... - AttributeError: '' object has no attribute '_sbox' + AttributeError: '' object has no attribute '_sbox'... """ return self._sbox diff --git a/src/sage/data_structures/bitset.pyx b/src/sage/data_structures/bitset.pyx index 446062554c1..d9906b5edd2 100644 --- a/src/sage/data_structures/bitset.pyx +++ b/src/sage/data_structures/bitset.pyx @@ -967,7 +967,7 @@ cdef class FrozenBitset: sage: None | FrozenBitset('10101') Traceback (most recent call last): ... - AttributeError: 'NoneType' object has no attribute '_union' + AttributeError: 'NoneType' object has no attribute '_union'... """ return self._union(other) @@ -1037,7 +1037,7 @@ cdef class FrozenBitset: sage: None & FrozenBitset("101011") Traceback (most recent call last): ... - AttributeError: 'NoneType' object has no attribute 'intersection' + AttributeError: 'NoneType' object has no attribute 'intersection'... """ return self.intersection(other) @@ -1106,7 +1106,7 @@ cdef class FrozenBitset: sage: None - FrozenBitset('10101') Traceback (most recent call last): ... - AttributeError: 'NoneType' object has no attribute 'difference' + AttributeError: 'NoneType' object has no attribute 'difference'... """ return self.difference(other) @@ -1179,7 +1179,7 @@ cdef class FrozenBitset: sage: None ^^ FrozenBitset('11111' * 10) Traceback (most recent call last): ... - AttributeError: 'NoneType' object has no attribute 'symmetric_difference' + AttributeError: 'NoneType' object has no attribute 'symmetric_difference'... """ return self.symmetric_difference(other) diff --git a/src/sage/doctest/reporting.py b/src/sage/doctest/reporting.py index 361fea344c2..a3947c07e01 100644 --- a/src/sage/doctest/reporting.py +++ b/src/sage/doctest/reporting.py @@ -368,7 +368,7 @@ def report(self, source, timeout, return_code, results, output, pid=None): sage: DTR.report(None, None, None, None, None) Traceback (most recent call last): ... - AttributeError: 'NoneType' object has no attribute 'basename' + AttributeError: 'NoneType' object has no attribute 'basename'... The only-errors mode does not output anything on success:: diff --git a/src/sage/dynamics/finite_dynamical_system.py b/src/sage/dynamics/finite_dynamical_system.py index e5fbf568b7e..4295070615a 100644 --- a/src/sage/dynamics/finite_dynamical_system.py +++ b/src/sage/dynamics/finite_dynamical_system.py @@ -240,7 +240,7 @@ class DiscreteDynamicalSystem(SageObject, metaclass=ClasscallMetaclass): sage: D.inverse_evolution()(4) Traceback (most recent call last): ... - AttributeError: 'DiscreteDynamicalSystem' object has no attribute 'inverse_evolution' + AttributeError: 'DiscreteDynamicalSystem' object has no attribute 'inverse_evolution'... sage: D.orbit(3) [3, 5, 1] @@ -252,7 +252,7 @@ class DiscreteDynamicalSystem(SageObject, metaclass=ClasscallMetaclass): sage: D.inverse_evolution()(4) Traceback (most recent call last): ... - AttributeError: 'DiscreteDynamicalSystem' object has no attribute 'inverse_evolution' + AttributeError: 'DiscreteDynamicalSystem' object has no attribute 'inverse_evolution'... sage: D.orbit(3) [3, 5, 1] diff --git a/src/sage/geometry/cone.py b/src/sage/geometry/cone.py index 1b4a60b0013..c2a9252bd72 100644 --- a/src/sage/geometry/cone.py +++ b/src/sage/geometry/cone.py @@ -340,7 +340,7 @@ def Cone(rays, lattice=None, check=True, normalize=True): sage: Cone([(1,0), (0,1)], check=False, normalize=False) Traceback (most recent call last): ... - AttributeError: 'tuple' object has no attribute 'parent' + AttributeError: 'tuple' object has no attribute 'parent'... You can construct different "not" cones: not full-dimensional, not strictly convex, not containing any rays:: diff --git a/src/sage/geometry/fan.py b/src/sage/geometry/fan.py index 258544012fe..3aecc84a55b 100644 --- a/src/sage/geometry/fan.py +++ b/src/sage/geometry/fan.py @@ -443,7 +443,7 @@ def Fan(cones, rays=None, lattice=None, check=True, normalize=True, sage: P2c = Fan(cones, rays, check=False, normalize=False) Traceback (most recent call last): ... - AttributeError: 'tuple' object has no attribute 'parent' + AttributeError: 'tuple' object has no attribute 'parent'... Yet another way is to use functions :func:`FaceFan` and :func:`NormalFan` to construct fans from :class:`lattice polytopes diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index f0ac1e774a7..98782303012 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -351,7 +351,7 @@ cdef class FaceIterator_base(SageObject): sage: FaceIterator_base(2) # indirect doctest Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute 'combinatorial_polyhedron' + AttributeError: 'sage.rings.integer.Integer' object has no attribute 'combinatorial_polyhedron'... """ cdef int i sig_free(self.structure.atom_rep) diff --git a/src/sage/geometry/toric_plotter.py b/src/sage/geometry/toric_plotter.py index 50b4008eb0f..950e3ba7ff8 100644 --- a/src/sage/geometry/toric_plotter.py +++ b/src/sage/geometry/toric_plotter.py @@ -706,7 +706,7 @@ def set_rays(self, generators): sage: tp.plot_rays() # needs sage.plot Traceback (most recent call last): ... - AttributeError: 'ToricPlotter' object has no attribute 'rays' + AttributeError: 'ToricPlotter' object has no attribute 'rays'... sage: tp.set_rays([(0,1)]) sage: tp.plot_rays() # needs sage.plot Graphics object consisting of 2 graphics primitives diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py index d0ec214bb3b..c8098ad578a 100644 --- a/src/sage/groups/matrix_gps/finitely_generated.py +++ b/src/sage/groups/matrix_gps/finitely_generated.py @@ -268,7 +268,7 @@ def MatrixGroup(*gens, **kwds): sage: SL2C.gens() Traceback (most recent call last): ... - AttributeError: 'LinearMatrixGroup_generic_with_category' object has no attribute 'gens' + AttributeError: 'LinearMatrixGroup_generic_with_category' object has no attribute 'gens'... """ if isinstance(gens[-1], dict): # hack for unpickling kwds.update(gens[-1]) diff --git a/src/sage/homology/chains.py b/src/sage/homology/chains.py index 87c0947c0b0..b9a54940943 100644 --- a/src/sage/homology/chains.py +++ b/src/sage/homology/chains.py @@ -298,7 +298,7 @@ def is_cycle(self): sage: chain.is_cocycle() Traceback (most recent call last): ... - AttributeError: 'Chains_with_category.element_class' object has no attribute 'is_cocycle' + AttributeError: 'Chains_with_category.element_class' object has no attribute 'is_cocycle'... """ return self.to_complex().is_cycle() @@ -325,7 +325,7 @@ def is_boundary(self): sage: chain.is_coboundary() Traceback (most recent call last): ... - AttributeError: 'Chains_with_category.element_class' object has no attribute 'is_coboundary' + AttributeError: 'Chains_with_category.element_class' object has no attribute 'is_coboundary'... """ return self.to_complex().is_boundary() @@ -539,7 +539,7 @@ def is_cocycle(self): sage: cochain.is_cycle() Traceback (most recent call last): ... - AttributeError: 'Cochains_with_category.element_class' object has no attribute 'is_cycle' + AttributeError: 'Cochains_with_category.element_class' object has no attribute 'is_cycle'... """ return self.to_complex().is_cycle() @@ -566,7 +566,7 @@ def is_coboundary(self): sage: cochain.is_boundary() Traceback (most recent call last): ... - AttributeError: 'Cochains_with_category.element_class' object has no attribute 'is_boundary' + AttributeError: 'Cochains_with_category.element_class' object has no attribute 'is_boundary'... """ return self.to_complex().is_boundary() @@ -604,7 +604,7 @@ def eval(self, other): sage: z.eval(c) # z is not a cochain Traceback (most recent call last): ... - AttributeError: 'Chains_with_category.element_class' object has no attribute 'eval' + AttributeError: 'Chains_with_category.element_class' object has no attribute 'eval'... sage: c.eval(c) # can't evaluate a cochain on a cochain Traceback (most recent call last): ... diff --git a/src/sage/homology/free_resolution.py b/src/sage/homology/free_resolution.py index e3d38de4240..280a479b438 100644 --- a/src/sage/homology/free_resolution.py +++ b/src/sage/homology/free_resolution.py @@ -275,7 +275,7 @@ def differential(self, i): sage: FreeResolution.differiental(r, 1) Traceback (most recent call last): ... - AttributeError: type object 'FreeResolution' has no attribute 'differiental' + AttributeError: type object 'FreeResolution' has no attribute 'differiental'... """ def target(self): diff --git a/src/sage/interfaces/magma.py b/src/sage/interfaces/magma.py index b7a0ac20d03..529bfbc349b 100644 --- a/src/sage/interfaces/magma.py +++ b/src/sage/interfaces/magma.py @@ -824,7 +824,7 @@ def _coerce_from_special_method(self, x): sage: magma._coerce_from_special_method('2 + 3') # optional - magma Traceback (most recent call last): ... - AttributeError: 'str' object has no attribute '_magma_init_' + AttributeError: 'str' object has no attribute '_magma_init_'... """ s = x._magma_init_(self) a = self(s) diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx index 478caf9f9d0..363024ae281 100644 --- a/src/sage/libs/gap/element.pyx +++ b/src/sage/libs/gap/element.pyx @@ -380,7 +380,7 @@ cdef GapElement make_GapElement(parent, Obj obj): sage: libgap(None) Traceback (most recent call last): ... - AttributeError: 'NoneType' object has no attribute '_libgap_init_' + AttributeError: 'NoneType' object has no attribute '_libgap_init_'... """ cdef GapElement r = GapElement.__new__(GapElement) r._initialize(parent, obj) diff --git a/src/sage/manifolds/calculus_method.py b/src/sage/manifolds/calculus_method.py index f5830c0bc45..303dde6cd13 100644 --- a/src/sage/manifolds/calculus_method.py +++ b/src/sage/manifolds/calculus_method.py @@ -257,7 +257,7 @@ def simplify(self, expression, method=None): sage: cm.simplify(f) Traceback (most recent call last): ... - AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'combsimp' + AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'combsimp'... In the present case, one should either transform ``f`` to a SymPy object:: diff --git a/src/sage/manifolds/differentiable/vectorfield_module.py b/src/sage/manifolds/differentiable/vectorfield_module.py index 11b94366a40..ea7307f810d 100644 --- a/src/sage/manifolds/differentiable/vectorfield_module.py +++ b/src/sage/manifolds/differentiable/vectorfield_module.py @@ -885,7 +885,7 @@ def tensor(self, *args, **kwds): sage: XM.tensor(XM).tensor(XM.dual().tensor(XM.dual())) Traceback (most recent call last): ... - AttributeError: 'TensorFieldModule_with_category' object has no attribute '_basis_sym' + AttributeError: 'TensorFieldModule_with_category' object has no attribute '_basis_sym'... .. SEEALSO:: diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index 86aca6e00d8..a5f6716e731 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -15303,7 +15303,7 @@ cdef class Matrix(Matrix1): Traceback (most recent call last): ... AttributeError: 'sage.rings.finite_rings.integer_mod.IntegerMod_int' object - has no attribute 'conjugate' + has no attribute 'conjugate'... """ # limited testing on a 1000 x 1000 matrix over CC: # transpose is fast, conjugate is slow diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx index f54f3423ded..a49bb6240e6 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pyx +++ b/src/sage/matrix/matrix_cyclo_dense.pyx @@ -847,7 +847,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): sage: A.set_mutable() Traceback (most recent call last): ... - AttributeError: 'sage.matrix.matrix_cyclo_dense.Matrix_cyclo_dense' object has no attribute 'set_mutable' + AttributeError: 'sage.matrix.matrix_cyclo_dense.Matrix_cyclo_dense' object has no attribute 'set_mutable'... sage: B = A.__copy__() sage: B[0,0] = 20 sage: B[0,0] diff --git a/src/sage/matrix/matrix_gfpn_dense.pyx b/src/sage/matrix/matrix_gfpn_dense.pyx index 4cccf473de1..8e8e4d7336b 100644 --- a/src/sage/matrix/matrix_gfpn_dense.pyx +++ b/src/sage/matrix/matrix_gfpn_dense.pyx @@ -159,7 +159,7 @@ cdef class FieldConverter_class: sage: C.field_to_fel('foo') Traceback (most recent call last): ... - AttributeError: 'str' object has no attribute 'to_integer' + AttributeError: 'str' object has no attribute 'to_integer'... """ return FfFromInt(x.to_integer()) diff --git a/src/sage/matrix/matrix_space.py b/src/sage/matrix/matrix_space.py index 6aab58352be..b5e6f52349b 100644 --- a/src/sage/matrix/matrix_space.py +++ b/src/sage/matrix/matrix_space.py @@ -1619,7 +1619,7 @@ def __getitem__(self, x): sage: MS[2] Traceback (most recent call last): ... - AttributeError: 'MatrixSpace_with_category' object has no attribute 'list' + AttributeError: 'MatrixSpace_with_category' object has no attribute 'list'... """ if isinstance(x, (integer.Integer, int)): return self.list()[x] diff --git a/src/sage/matroids/linear_matroid.pyx b/src/sage/matroids/linear_matroid.pyx index 36f563aa433..318c82f2b64 100644 --- a/src/sage/matroids/linear_matroid.pyx +++ b/src/sage/matroids/linear_matroid.pyx @@ -1134,7 +1134,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): Traceback (most recent call last): ... AttributeError: 'sage.matroids.basis_matroid.BasisMatroid' object - has no attribute 'base_ring' + has no attribute 'base_ring'... sage: from sage.matroids.advanced import * sage: M4 = BinaryMatroid(Matrix(M1)) sage: M5 = LinearMatroid(reduced_matrix=Matrix(GF(2), [[-1, 0, 1], diff --git a/src/sage/misc/functional.py b/src/sage/misc/functional.py index c922b8f6f12..03697f08b7c 100644 --- a/src/sage/misc/functional.py +++ b/src/sage/misc/functional.py @@ -86,7 +86,7 @@ def base_field(x): sage: R.base_field() Traceback (most recent call last): ... - AttributeError: 'PolynomialRing_dense_mod_p_with_category' object has no attribute 'base_field' + AttributeError: 'PolynomialRing_dense_mod_p_with_category' object has no attribute 'base_field'... """ try: return x.base_field() diff --git a/src/sage/misc/instancedoc.pyx b/src/sage/misc/instancedoc.pyx index d8e1e4ac536..44ee70f64ba 100644 --- a/src/sage/misc/instancedoc.pyx +++ b/src/sage/misc/instancedoc.pyx @@ -256,7 +256,7 @@ cdef class InstanceDocDescriptor: sage: descr.__delete__(obj) Traceback (most recent call last): ... - AttributeError: 'X' object has no attribute '__doc__' + AttributeError: 'X' object has no attribute '__doc__'... sage: descr.__delete__([]) Traceback (most recent call last): diff --git a/src/sage/misc/lazy_attribute.pyx b/src/sage/misc/lazy_attribute.pyx index bdbec3b3ba1..1f07870b8ec 100644 --- a/src/sage/misc/lazy_attribute.pyx +++ b/src/sage/misc/lazy_attribute.pyx @@ -441,37 +441,37 @@ class lazy_attribute(_lazy_attribute): sage: B().unimplemented_A # todo: not implemented Traceback (most recent call last): ... - AttributeError: 'super' object has no attribute 'unimplemented_A' + AttributeError: 'super' object has no attribute 'unimplemented_A'... We now make some systematic checks:: sage: B().unimplemented_A Traceback (most recent call last): ... - AttributeError: '...' object has no attribute 'unimplemented_A' + AttributeError: '...' object has no attribute 'unimplemented_A'... sage: B().unimplemented_B Traceback (most recent call last): ... - AttributeError: '...' object has no attribute 'unimplemented_B' + AttributeError: '...' object has no attribute 'unimplemented_B'... sage: B().unimplemented_AB Traceback (most recent call last): ... - AttributeError: '...' object has no attribute 'unimplemented_AB' + AttributeError: '...' object has no attribute 'unimplemented_AB'... sage: B().unimplemented_B_implemented_A 1 sage: C().unimplemented_A() Traceback (most recent call last): ... - AttributeError: '...' object has no attribute 'unimplemented_A' + AttributeError: '...' object has no attribute 'unimplemented_A'... sage: C().unimplemented_B() Traceback (most recent call last): ... - AttributeError: '...' object has no attribute 'unimplemented_B' + AttributeError: '...' object has no attribute 'unimplemented_B'... sage: C().unimplemented_AB() Traceback (most recent call last): ... - AttributeError: '...' object has no attribute 'unimplemented_AB' + AttributeError: '...' object has no attribute 'unimplemented_AB'... sage: C().unimplemented_B_implemented_A # todo: not implemented 1 """ diff --git a/src/sage/misc/object_multiplexer.py b/src/sage/misc/object_multiplexer.py index d4e811ef16e..00fd89d6652 100644 --- a/src/sage/misc/object_multiplexer.py +++ b/src/sage/misc/object_multiplexer.py @@ -85,7 +85,7 @@ def __getattr__(self, name): sage: m.__bork__ Traceback (most recent call last): ... - AttributeError: 'Multiplex' has no attribute '__bork__' + AttributeError: 'Multiplex' has no attribute '__bork__'... """ if name.startswith("__"): raise AttributeError("'Multiplex' has no attribute '%s'" % name) diff --git a/src/sage/misc/sage_input.py b/src/sage/misc/sage_input.py index 66e78ecccbc..00e8d96ee9e 100644 --- a/src/sage/misc/sage_input.py +++ b/src/sage/misc/sage_input.py @@ -3461,7 +3461,7 @@ def verify_same(a, b): sage: verify_same(1, 1r) Traceback (most recent call last): ... - AttributeError: 'int' object has no attribute 'parent' + AttributeError: 'int' object has no attribute 'parent'... sage: verify_same(1r, 1) Traceback (most recent call last): ... @@ -3525,7 +3525,7 @@ def verify_si_answer(x, answer, preparse): sage: verify_si_answer(1, '1', False) Traceback (most recent call last): ... - AttributeError: 'int' object has no attribute 'parent' + AttributeError: 'int' object has no attribute 'parent'... sage: verify_si_answer(1, 'ZZ(1)', None) """ from sage.misc.sage_eval import sage_eval diff --git a/src/sage/modules/fp_graded/steenrod/module.py b/src/sage/modules/fp_graded/steenrod/module.py index 18460b0e9a1..4acfa6b4002 100755 --- a/src/sage/modules/fp_graded/steenrod/module.py +++ b/src/sage/modules/fp_graded/steenrod/module.py @@ -70,7 +70,7 @@ sage: SteenrodFPModule(ZZ, [0]) Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer_ring.IntegerRing_class' object has no attribute 'free_graded_module' + AttributeError: 'sage.rings.integer_ring.IntegerRing_class' object has no attribute 'free_graded_module'... AUTHORS: diff --git a/src/sage/parallel/map_reduce.py b/src/sage/parallel/map_reduce.py index 11e0673ee91..5441943731d 100644 --- a/src/sage/parallel/map_reduce.py +++ b/src/sage/parallel/map_reduce.py @@ -1234,7 +1234,7 @@ def finish(self): sage: S.print_communication_statistics() Traceback (most recent call last): ... - AttributeError: 'RESetMPExample' object has no attribute '_stats' + AttributeError: 'RESetMPExample' object has no attribute '_stats'... sage: S.finish() diff --git a/src/sage/plot/colors.py b/src/sage/plot/colors.py index 8c0db2b3c34..3281199400b 100644 --- a/src/sage/plot/colors.py +++ b/src/sage/plot/colors.py @@ -1099,7 +1099,7 @@ def __getattr__(self, name): sage: cols.punk Traceback (most recent call last): ... - AttributeError: 'ColorsDict' has no attribute or colormap punk + AttributeError: 'ColorsDict' has no attribute or colormap punk... """ try: return self[name] @@ -1599,7 +1599,7 @@ def __getattr__(self, name): sage: maps.punk Traceback (most recent call last): ... - AttributeError: 'Colormaps' has no attribute or colormap punk + AttributeError: 'Colormaps' has no attribute or colormap punk... sage: maps['punk'] Traceback (most recent call last): ... diff --git a/src/sage/rings/asymptotic/asymptotic_ring.py b/src/sage/rings/asymptotic/asymptotic_ring.py index b07319382d3..994490e6616 100644 --- a/src/sage/rings/asymptotic/asymptotic_ring.py +++ b/src/sage/rings/asymptotic/asymptotic_ring.py @@ -1091,7 +1091,7 @@ def monomial_coefficient(self, monomial): sage: O(n).monomial_coefficient(n) Traceback (most recent call last): ... - AttributeError: 'OTermMonoid_with_category.element_class' object has no attribute 'coefficient' + AttributeError: 'OTermMonoid_with_category.element_class' object has no attribute 'coefficient'... The ``monomial`` must be exact:: diff --git a/src/sage/rings/asymptotic/growth_group.py b/src/sage/rings/asymptotic/growth_group.py index 906a0dbae57..3744eb2027f 100644 --- a/src/sage/rings/asymptotic/growth_group.py +++ b/src/sage/rings/asymptotic/growth_group.py @@ -1572,7 +1572,7 @@ def variable_names(self): Traceback (most recent call last): ... AttributeError: 'GenericGrowthGroup_with_category.element_class' object - has no attribute 'is_one' + has no attribute 'is_one'... """ if self.is_one(): return tuple() diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py index d36d9406f32..01c9fa3bf2d 100644 --- a/src/sage/rings/ideal.py +++ b/src/sage/rings/ideal.py @@ -1553,7 +1553,7 @@ def gcd(self, other): sage: J.gcd(I) Traceback (most recent call last): ... - AttributeError: 'Ideal_generic' object has no attribute 'gcd' + AttributeError: 'Ideal_generic' object has no attribute 'gcd'... Note:: diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index b4ba6de1362..7ffeeca710b 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -3823,7 +3823,7 @@ def primes_above(self, x, degree=None): sage: F.prime_above(0) Traceback (most recent call last): ... - AttributeError: 'NumberFieldIdeal' object has no attribute 'prime_factors' + AttributeError: 'NumberFieldIdeal' object has no attribute 'prime_factors'... """ if degree is not None: degree = ZZ(degree) @@ -3917,7 +3917,7 @@ def prime_above(self, x, degree=None): sage: F.prime_above(0) Traceback (most recent call last): ... - AttributeError: 'NumberFieldIdeal' object has no attribute 'prime_factors' + AttributeError: 'NumberFieldIdeal' object has no attribute 'prime_factors'... """ ids = self.primes_above(x, degree) @@ -5926,7 +5926,7 @@ def factor(self, n): sage: L.factor(0) Traceback (most recent call last): ... - AttributeError: 'NumberFieldIdeal' object has no attribute 'factor' + AttributeError: 'NumberFieldIdeal' object has no attribute 'factor'... AUTHORS: @@ -12698,7 +12698,7 @@ def is_real_place(v): sage: is_real_place(v_fin) Traceback (most recent call last): ... - AttributeError: 'NumberFieldFractionalIdeal' object has no attribute 'im_gens' + AttributeError: 'NumberFieldFractionalIdeal' object has no attribute 'im_gens'... """ RR = sage.rings.real_mpfr.RealField(53) diff --git a/src/sage/rings/padics/generic_nodes.py b/src/sage/rings/padics/generic_nodes.py index 7047020edec..b6b514d4005 100644 --- a/src/sage/rings/padics/generic_nodes.py +++ b/src/sage/rings/padics/generic_nodes.py @@ -740,7 +740,7 @@ def _get_element_class(self, name=None): sage: R._get_element_class("foobar") Traceback (most recent call last): ... - AttributeError: module 'sage.rings.padics.padic_relaxed_element' has no attribute 'pAdicRelaxedElement_foobar' + AttributeError: module 'sage.rings.padics.padic_relaxed_element' has no attribute 'pAdicRelaxedElement_foobar'... """ if name is None: return self.Element diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index c5a1129aecf..a5b7f937cfe 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -10793,7 +10793,7 @@ cdef class Polynomial(CommutativePolynomial): sage: (y**2 + x).nth_root(2) Traceback (most recent call last): ... - AttributeError: ... has no attribute 'nth_root' + AttributeError: ... has no attribute 'nth_root'... TESTS:: @@ -11831,7 +11831,7 @@ cdef class Polynomial_generic_dense(Polynomial): sage: int(1) // x # check that this doesn't segfault Traceback (most recent call last): ... - AttributeError: type object 'int' has no attribute 'base_ring' + AttributeError: type object 'int' has no attribute 'base_ring'... """ if have_same_parent(self, right): return (self)._floordiv_(right) diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py index 99d90a5c8f7..ee97f641990 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py @@ -2362,7 +2362,7 @@ def field_extension(self, names): sage: F, g, h = S.field_extension('b') # needs sage.rings.finite_rings Traceback (most recent call last): ... - AttributeError: 'PolynomialQuotientRing_generic_with_category' object has no attribute 'field_extension' + AttributeError: 'PolynomialQuotientRing_generic_with_category' object has no attribute 'field_extension'... Over a finite field, the corresponding field extension is not a number field:: diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx index 5273891a5b0..a6e999b8805 100644 --- a/src/sage/rings/ring.pyx +++ b/src/sage/rings/ring.pyx @@ -1734,7 +1734,7 @@ cdef class IntegralDomain(CommutativeRing): sage: Z5.is_integrally_closed() Traceback (most recent call last): ... - AttributeError: 'IntegerModRing_generic_with_category' object has no attribute 'is_integrally_closed' + AttributeError: 'IntegerModRing_generic_with_category' object has no attribute 'is_integrally_closed'... """ raise NotImplementedError diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index 1c8944b6dfc..5d64d632f97 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -246,7 +246,7 @@ Traceback (most recent call last): ... AttributeError: 'SchemeMorphism_fan_toric_variety' object - has no attribute 'fiber_generic' + has no attribute 'fiber_generic'... Let's use factorization mentioned above:: diff --git a/src/sage/sets/disjoint_union_enumerated_sets.py b/src/sage/sets/disjoint_union_enumerated_sets.py index 2375f4d191a..d6e7fbdde72 100644 --- a/src/sage/sets/disjoint_union_enumerated_sets.py +++ b/src/sage/sets/disjoint_union_enumerated_sets.py @@ -619,7 +619,7 @@ def Element(self): Traceback (most recent call last): ... AttributeError: 'DisjointUnionEnumeratedSets_with_category' object - has no attribute 'Element' + has no attribute 'Element'... """ if not self._facade: return ElementWrapper diff --git a/src/sage/sets/set.py b/src/sage/sets/set.py index 4e8789a2d57..a6a746e9aca 100644 --- a/src/sage/sets/set.py +++ b/src/sage/sets/set.py @@ -167,7 +167,7 @@ def Set(X=None, category=None): sage: sorted(B.list(), key=repr) Traceback (most recent call last): ... - AttributeError: 'Set_object_with_category' object has no attribute 'list' + AttributeError: 'Set_object_with_category' object has no attribute 'list'... sage: type(B) diff --git a/src/sage/structure/category_object.pyx b/src/sage/structure/category_object.pyx index b6a7eaecb5b..c06933494dc 100644 --- a/src/sage/structure/category_object.pyx +++ b/src/sage/structure/category_object.pyx @@ -836,7 +836,7 @@ cdef class CategoryObject(SageObject): sage: Sets().example().sadfasdf Traceback (most recent call last): ... - AttributeError: 'PrimeNumbers_with_category' object has no attribute 'sadfasdf' + AttributeError: 'PrimeNumbers_with_category' object has no attribute 'sadfasdf'... """ return self.getattr_from_category(name) diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index caae7e40ffc..41b022a3fd7 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -219,7 +219,7 @@ the parents:: sage: x._add_(x) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_add_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_add_'... sage: x + x Traceback (most recent call last): ... @@ -478,13 +478,13 @@ cdef class Element(SageObject): sage: 1.blah_blah Traceback (most recent call last): ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute 'blah_blah' + AttributeError: 'sage.rings.integer.Integer' object has no attribute 'blah_blah'... sage: Semigroups().example().an_element().is_idempotent sage: Semigroups().example().an_element().blah_blah Traceback (most recent call last): ... - AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah' + AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah'... """ return self.getattr_from_category(name) @@ -1269,7 +1269,7 @@ cdef class Element(SageObject): sage: e._add_(e) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_add_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_add_'... """ try: python_op = (self)._add_ @@ -1381,7 +1381,7 @@ cdef class Element(SageObject): sage: e._sub_(e) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_sub_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_sub_'... """ try: python_op = (self)._sub_ @@ -1435,7 +1435,7 @@ cdef class Element(SageObject): sage: e._neg_() Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_neg_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_neg_'... """ try: python_op = (self)._neg_ @@ -1549,7 +1549,7 @@ cdef class Element(SageObject): sage: e._mul_(e) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_mul_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_mul_'... """ try: python_op = (self)._mul_ @@ -1662,7 +1662,7 @@ cdef class Element(SageObject): sage: e._matmul_(e) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_matmul_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_matmul_'... """ try: python_op = (self)._matmul_ @@ -1765,7 +1765,7 @@ cdef class Element(SageObject): sage: e._div_(e) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_div_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_div_'... """ try: python_op = (self)._div_ @@ -1865,7 +1865,7 @@ cdef class Element(SageObject): sage: e._floordiv_(e) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_floordiv_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_floordiv_'... """ try: python_op = (self)._floordiv_ @@ -1965,7 +1965,7 @@ cdef class Element(SageObject): sage: e._mod_(e) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_mod_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_mod_'... """ try: python_op = (self)._mod_ @@ -2092,7 +2092,7 @@ cdef class Element(SageObject): sage: e._pow_(e) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_pow_' + AttributeError: 'sage.structure.element.Element' object has no attribute '_pow_'... """ try: python_op = (self)._pow_ @@ -2122,7 +2122,7 @@ cdef class Element(SageObject): sage: e._pow_int(e) Traceback (most recent call last): ... - AttributeError: 'sage.structure.element.Element' object has no attribute '_pow_int' + AttributeError: 'sage.structure.element.Element' object has no attribute '_pow_int'... """ try: python_op = (self)._pow_int @@ -2856,7 +2856,7 @@ cdef class RingElement(ModuleElement): sage: m.is_nilpotent() # needs sage.modules Traceback (most recent call last): ... - AttributeError: ... object has no attribute 'is_nilpotent' + AttributeError: ... object has no attribute 'is_nilpotent'... """ if self.is_unit(): return False @@ -4671,7 +4671,7 @@ def coerce_binop(method): sage: x.test_add(CC(2)) Traceback (most recent call last): ... - AttributeError: 'sage.rings.complex_mpfr.ComplexNumber' object has no attribute 'test_add' + AttributeError: 'sage.rings.complex_mpfr.ComplexNumber' object has no attribute 'test_add'... TESTS: diff --git a/src/sage/structure/sequence.py b/src/sage/structure/sequence.py index 0c700c1fb81..c3972532ac3 100644 --- a/src/sage/structure/sequence.py +++ b/src/sage/structure/sequence.py @@ -854,7 +854,7 @@ def __getattr__(self, name): sage: S.universe() Traceback (most recent call last): ... - AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__universe' + AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__universe'... sage: S._Sequence__universe = 'foobar' sage: S.universe() 'foobar' @@ -867,7 +867,7 @@ def __getattr__(self, name): sage: hash(S) Traceback (most recent call last): ... - AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__hash' + AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__hash'... sage: S._Sequence__hash = int(34) sage: hash(S) 34 diff --git a/src/sage/symbolic/pynac_impl.pxi b/src/sage/symbolic/pynac_impl.pxi index 68c31dcfde7..7fd7c3b314b 100644 --- a/src/sage/symbolic/pynac_impl.pxi +++ b/src/sage/symbolic/pynac_impl.pxi @@ -619,7 +619,7 @@ def tolerant_is_symbol(a): sage: None.is_symbol() Traceback (most recent call last): ... - AttributeError: 'NoneType' object has no attribute 'is_symbol' + AttributeError: 'NoneType' object has no attribute 'is_symbol'... """ try: return a.is_symbol() From 5e34da9bf9b310e1f10b007f3c26a6b90e34f609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 3 Oct 2023 20:20:41 -0300 Subject: [PATCH 2/2] py312: fix AttributeError doctests (manual changes) In python 3.12, attribute errors add a suggestion at the end of the usual error message ("Did you mean ...?"). We add ... at the end of these doctest outputs to fix it. This commit has a few manual changes which didn't match the sed pattern in the previous commit. --- src/sage/structure/element.pyx | 2 +- src/sage/symbolic/assumptions.py | 2 +- src/sage/symbolic/expression.pyx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index 41b022a3fd7..543506e9a74 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -2856,7 +2856,7 @@ cdef class RingElement(ModuleElement): sage: m.is_nilpotent() # needs sage.modules Traceback (most recent call last): ... - AttributeError: ... object has no attribute 'is_nilpotent'... + AttributeError: '...' object has no attribute 'is_nilpotent'... """ if self.is_unit(): return False diff --git a/src/sage/symbolic/assumptions.py b/src/sage/symbolic/assumptions.py index 7dcb15f0d85..15f6fa07ce6 100644 --- a/src/sage/symbolic/assumptions.py +++ b/src/sage/symbolic/assumptions.py @@ -636,7 +636,7 @@ def assume(*args): Traceback (most recent call last): ... AttributeError: 'sage.rings.integer.Integer' object has no - attribute 'assume' + attribute 'assume'... Ensure that we can combine the two types of assumptions, as documented:: diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 0f251ac4e5c..66f624141b3 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -13712,7 +13712,7 @@ cdef get_dynamic_class_for_function(unsigned serial): Traceback (most recent call last): ... AttributeError: 'sage.symbolic.expression.Expression' object has no - attribute 'argp1' + attribute 'argp1'... sage: t = (e + 1).op[0]; t tfunc(x) sage: t