Skip to content

Commit 98093fe

Browse files
author
Matthias Koeppe
committed
MPolynomial_element._test_subs: Test substituting 1 variable only in rings with > 1 variable
1 parent b4e5ab1 commit 98093fe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/sage/rings/polynomial/multi_polynomial_element.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,17 +398,18 @@ def _test_subs(self, tester=None, **options):
398398
d = {str(gen): 0 for gen in gens}
399399
tester.assertEqual(self.subs(**d).parent(), self.parent().base_ring())
400400

401-
# substituting one variable (in a polynomial ring with variables) with 0
402-
d = {str(gens[0]): 0}
403-
tester.assertEqual(self.subs(**d).parent(), self.parent())
404-
405401
# substituting all variables (in a polynomial ring with variables)
406402
# with elements of another ring
407403
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
408404
other = PolynomialRing(self.parent().base_ring(), 'other', len(gens))
409405
d = {str(gen): other_gen for gen, other_gen in zip(gens, other.gens())}
410406
tester.assertEqual(self.subs(**d).parent(), other)
411407

408+
if len(gens) > 1:
409+
# substituting one variable (in a polynomial ring with variables) with 0
410+
d = {str(gens[0]): 0}
411+
tester.assertEqual(self.subs(**d).parent(), self.parent())
412+
412413

413414
class MPolynomial_polydict(Polynomial_singular_repr, MPolynomial_element):
414415
r"""

0 commit comments

Comments
 (0)