Skip to content

Commit

Permalink
sagemathgh-39573: Doctest for defining multivariate polynomial ring o…
Browse files Browse the repository at this point in the history
…ver InfinityRing

    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

Fixes sagemath#34675

Previously, defining a multivariate polynomial ring over InfinityRing
would incorrectly result in an error. As mentioned in the comments under
the linked issue, this behaviour was fixed in version 10.3 but a doctest
was still needed.

This pull request adds the required doctest, verifying that the
statement `PolynomialRing(InfinityRing,2,'x')` correctly generates a
ring instead of throwing an error.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [X] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#39573
Reported by: Caleb Van't Land
Reviewer(s):
  • Loading branch information
Release Manager committed Feb 27, 2025
2 parents 1bc98df + 2732887 commit 1b95945
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sage/rings/polynomial/polynomial_ring_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,12 @@ def PolynomialRing(base_ring, *args, **kwds):
....: '_test_distributivity', '_test_prod'])
sage: R.<x,y> = PolynomialRing(RIF,2)
sage: TestSuite(R).run(skip=['_test_elements', '_test_elements_eq_transitive'])
We verify that multivariate polynomial rings over ``InfinityRing`` from
:issue:`34675` are fixed::
sage: PolynomialRing(InfinityRing, 2, 'x')
Multivariate Polynomial Ring in x0, x1 over The Infinity Ring
"""
from sage.rings.semirings.tropical_semiring import TropicalSemiring
if base_ring not in Rings() and not isinstance(base_ring, TropicalSemiring):
Expand Down

0 comments on commit 1b95945

Please sign in to comment.