Skip to content

Commit 159a6f9

Browse files
author
Release Manager
committed
gh-36089: `sage.geometry.polyhedron`: fix doctest error due to modularization On MacOS with sagemath 10.1.rc0, I have the following doctest error in `src/sage/geometry/polyhedron/base_ZZ.py` ``` sage -t --long --warn-long 18.5 --random- seed=240228246560107174999702016603267109757 src/sage/geometry/polyhedron/base_ZZ.py ********************************************************************** File "src/sage/geometry/polyhedron/base_ZZ.py", line 419, in sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.? Failed example: hypercube(3).ehrhart_polynomial(engine='normaliz') Exception raised: Traceback (most recent call last): File "/Users/dcoudert/sage/src/sage/doctest/forker.py", line 709, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/dcoudert/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.?[9]>", line 1, in <module> hypercube(Integer(3)).ehrhart_polynomial(engine='normaliz') ^^^^^^^^^^^^^^^^^^^^^ File "<doctest sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.?[8]>", line 2, in hypercube return Polyhedron(vertices=list(product([Integer(0),Integer(1)], repeat=d)),backend='normaliz') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'sage.rings.integer.Integer' object is not iterable ********************************************************************** File "src/sage/geometry/polyhedron/base_ZZ.py", line 421, in sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.? Failed example: hypercube(4).ehrhart_polynomial(engine='normaliz') Exception raised: Traceback (most recent call last): File "/Users/dcoudert/sage/src/sage/doctest/forker.py", line 709, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/dcoudert/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.?[10]>", line 1, in <module> hypercube(Integer(4)).ehrhart_polynomial(engine='normaliz') ^^^^^^^^^^^^^^^^^^^^^ File "<doctest sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.?[8]>", line 2, in hypercube return Polyhedron(vertices=list(product([Integer(0),Integer(1)], repeat=d)),backend='normaliz') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'sage.rings.integer.Integer' object is not iterable ********************************************************************** File "src/sage/geometry/polyhedron/base_ZZ.py", line 423, in sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.? Failed example: hypercube(5).ehrhart_polynomial(engine='normaliz') Exception raised: Traceback (most recent call last): File "/Users/dcoudert/sage/src/sage/doctest/forker.py", line 709, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/dcoudert/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.?[11]>", line 1, in <module> hypercube(Integer(5)).ehrhart_polynomial(engine='normaliz') ^^^^^^^^^^^^^^^^^^^^^ File "<doctest sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.?[8]>", line 2, in hypercube return Polyhedron(vertices=list(product([Integer(0),Integer(1)], repeat=d)),backend='normaliz') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'sage.rings.integer.Integer' object is not iterable ********************************************************************** File "src/sage/geometry/polyhedron/base_ZZ.py", line 425, in sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.? Failed example: hypercube(6).ehrhart_polynomial(engine='normaliz') Exception raised: Traceback (most recent call last): File "/Users/dcoudert/sage/src/sage/doctest/forker.py", line 709, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/dcoudert/sage/src/sage/doctest/forker.py", line 1144, in compile_and_execute exec(compiled, globs) File "<doctest sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.?[12]>", line 1, in <module> hypercube(Integer(6)).ehrhart_polynomial(engine='normaliz') ^^^^^^^^^^^^^^^^^^^^^ File "<doctest sage.geometry.polyhedron.base_ZZ.Polyhedron_ZZ.?[8]>", line 2, in hypercube return Polyhedron(vertices=list(product([Integer(0),Integer(1)], repeat=d)),backend='normaliz') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'sage.rings.integer.Integer' object is not iterable ``` This is caused by the `from itertools import product` in a block starting with `# optional - latte_int`. Apparently I don't have `latte_int` installed, and so this import is not done when starting the block with `pynormaliz` (I have it). So the fix is trivial. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36089 Reported by: David Coudert Reviewer(s): Matthias Köppe
2 parents 4d1a392 + fc72523 commit 159a6f9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/sage/geometry/polyhedron/base_ZZ.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ def ehrhart_polynomial(self, engine=None, variable='t', verbose=False, dual=None
414414
t^6 + 6*t^5 + 15*t^4 + 20*t^3 + 15*t^2 + 6*t + 1
415415
416416
sage: # optional - pynormaliz
417+
sage: from itertools import product
417418
sage: def hypercube(d):
418419
....: return Polyhedron(vertices=list(product([0,1],repeat=d)),backend='normaliz')
419420
sage: hypercube(3).ehrhart_polynomial(engine='normaliz')

0 commit comments

Comments
 (0)