Sage: Ticket #27965: py3: fix the last doctest in geometry
https://trac.sagemath.org/ticket/27965
<p>
or rather tag it with # py2
</p>
<p>
I have no idea why this does fail only in python3. But anyway, we cannot really do anything with the snub dodecahedron currently.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/27965
Trac 1.2Frédéric ChapotonMon, 10 Jun 2019 19:35:19 GMTcc, status changed; branch, commit set
https://trac.sagemath.org/ticket/27965#comment:1
https://trac.sagemath.org/ticket/27965#comment:1
<ul>
<li><strong>cc</strong>
<em>Travis Scrimshaw</em> added
</li>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>branch</strong>
set to <em>u/chapoton/27965</em>
</li>
<li><strong>commit</strong>
set to <em>7c9a636fa9198ccf3af036ec59ba459db5664416</em>
</li>
</ul>
<p>
very trivial ticket, please review swiftly
</p>
<hr />
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=7c9a636fa9198ccf3af036ec59ba459db5664416"><span class="icon"></span>7c9a636</a></td><td><code>py3: fix the last doctest in geometry</code>
</td></tr></table>
TicketJohn PalmieriMon, 10 Jun 2019 20:11:31 GMT
https://trac.sagemath.org/ticket/27965#comment:2
https://trac.sagemath.org/ticket/27965#comment:2
<p>
I think the issue here is not that <code>polytopes.snub_dodecahedron()</code> is broken in Python 3, but rather that Python 3 prints warning messages multiple times, whereas Python 2 only prints them once, at least while doctesting. A change like that in <a class="closed ticket" href="https://trac.sagemath.org/ticket/27612" title="#27612: defect: Py3 doctests in padic_lattice_element.py (closed: fixed)">#27612</a> might be another option:
</p>
<div class="wiki-code"><div xmlns="http://www.w3.org/1999/xhtml" class="diff">
<ul class="entries">
<li class="entry">
<h2>
<a>src/sage/geometry/polyhedron/library.py</a>
</h2>
<pre>diff --git a/src/sage/geometry/polyhedron/library.py b/src/sage/geometry/polyhedron/library.py
index 71914d635a..c9bb1f35e8 100644</pre>
<table class="trac-diff inline" summary="Differences" cellspacing="0">
<colgroup><col class="lineno" /><col class="lineno" /><col class="content" /></colgroup>
<thead>
<tr>
<th title="File a/src/sage/geometry/polyhedron/library.py">
a
</th>
<th title="File b/src/sage/geometry/polyhedron/library.py">
b
</th>
<td><em> class Polytopes():</em> </td>
</tr>
</thead>
<tbody class="unmod">
<tr>
<th>1489</th><th>1489</th><td class="l"><span> Unfortunately, no polyhedra backend supports the construction of the</span></td>
</tr><tr>
<th>1490</th><th>1490</th><td class="l"><span> snub dodecahedron at the moment::</span></td>
</tr><tr>
<th>1491</th><th>1491</th><td class="l"><span></span></td>
</tr>
</tbody><tbody class="mod">
<tr class="first">
<th>1492</th><th> </th><td class="l"><span> sage: sd = polytopes.snub_dodecahedron()</span></td>
</tr>
<tr>
<th> </th><th>1492</th><td class="r"><span> sage: sd = polytopes.snub_dodecahedron() # py2</span></td>
</tr><tr>
<th> </th><th>1493</th><td class="r"><span> sage: sd = polytopes.snub_dodecahedron() # py3</span></td>
</tr><tr>
<th> </th><th>1494</th><td class="r"><span> doctest:warning</span></td>
</tr><tr>
<th> </th><th>1495</th><td class="r"><span> ...</span></td>
</tr><tr class="last">
<th> </th><th>1496</th><td class="r"><span> UserWarning: This polyhedron data is numerically complicated; cdd could not convert between the inexact V and H representation without loss of data. The resulting object might show inconsistencies.</span></td>
</tr>
</tbody><tbody class="unmod">
<tr>
<th>1493</th><th>1497</th><td class="l"><span> sage: sd.f_vector() # not tested</span></td>
</tr><tr>
<th>1494</th><th>1498</th><td class="l"><span> (1, 60, 150, 92, 1)</span></td>
</tr><tr>
<th>1495</th><th>1499</th><td class="l"><span> sage: sd.base_ring() # not tested</span></td>
</tr>
</tbody>
</table>
</li>
</ul>
</div></div><p>
Given the comment, though ("no polyhedra backend supports the construction of the snub dodecahedron at the moment"), it's not a big deal.
</p>
TicketJohn PalmieriTue, 11 Jun 2019 04:05:52 GMTbranch changed
https://trac.sagemath.org/ticket/27965#comment:3
https://trac.sagemath.org/ticket/27965#comment:3
<ul>
<li><strong>branch</strong>
changed from <em>u/chapoton/27965</em> to <em>u/jhpalmieri/27965</em>
</li>
</ul>
TicketJohn PalmieriTue, 11 Jun 2019 04:06:38 GMTcommit, author changed
https://trac.sagemath.org/ticket/27965#comment:4
https://trac.sagemath.org/ticket/27965#comment:4
<ul>
<li><strong>commit</strong>
changed from <em>7c9a636fa9198ccf3af036ec59ba459db5664416</em> to <em>6fcdf0594952b6aa3234a75ef0d7137c84655583</em>
</li>
<li><strong>author</strong>
changed from <em>Frédéric Chapoton</em> to <em>Frédéric Chapoton, John Palmieri</em>
</li>
</ul>
<p>
I prefer my suggestion. When we move away from Python 2, it leaves a valid py3 command to execute.
</p>
<hr />
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=6fcdf0594952b6aa3234a75ef0d7137c84655583"><span class="icon"></span>6fcdf05</a></td><td><code>trac 27965: py3 fix in geometry/polyhedron/library.py</code>
</td></tr></table>
TicketFrédéric ChapotonTue, 11 Jun 2019 05:53:35 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/27965#comment:5
https://trac.sagemath.org/ticket/27965#comment:5
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Frédéric Chapoton</em>
</li>
</ul>
<p>
ok, good for me.
</p>
TicketJean-Philippe LabbéTue, 11 Jun 2019 19:26:46 GMT
https://trac.sagemath.org/ticket/27965#comment:6
https://trac.sagemath.org/ticket/27965#comment:6
<p>
... have a look at <a class="closed ticket" href="https://trac.sagemath.org/ticket/25097" title="#25097: enhancement: Algebraic polyhedra with Normaliz / e-antic (closed: fixed)">#25097</a>.
</p>
<p>
This test was removed and replaced by a reasonable test using the backend normaliz.
</p>
<p>
I would say that such computation over <code>RDF</code> should not be encouraged via examples/doctests as the backend normaliz provide reasonably fast computations with algebraic numbers.
</p>
TicketJean-Philippe LabbéTue, 11 Jun 2019 19:33:10 GMT
https://trac.sagemath.org/ticket/27965#comment:7
https://trac.sagemath.org/ticket/27965#comment:7
<p>
<code>cdd</code> and python2 and 3 have different behavior. In <a class="closed ticket" href="https://trac.sagemath.org/ticket/27760" title="#27760: enhancement: Generalized Permutohedra and type H4 4-uniform polytopes (closed: fixed)">#27760</a>, I was obtaining several times this kind of warnings in the default case due to approximation errors. When such errors occurred, I simply change the default behavior _not_ to produce such warnings and go for an exact solution.
</p>
<p>
I would really try to simply avoid making such tests in the future as we know that they are prone to produce such errors and we have a viable faster and reliable alternative (ok, with an optional package...).
</p>
TicketFrédéric ChapotonTue, 11 Jun 2019 19:39:57 GMT
https://trac.sagemath.org/ticket/27965#comment:8
https://trac.sagemath.org/ticket/27965#comment:8
<p>
But <a class="closed ticket" href="https://trac.sagemath.org/ticket/25097" title="#25097: enhancement: Algebraic polyhedra with Normaliz / e-antic (closed: fixed)">#25097</a> is not yet approved. The main aim in the present ticket is to later be able to lock the geometry folder (which means adding it to the list of python3-known-passing folders), so that no py3 failure could happen by accident.
</p>
TicketJohn PalmieriTue, 11 Jun 2019 19:51:11 GMT
https://trac.sagemath.org/ticket/27965#comment:9
https://trac.sagemath.org/ticket/27965#comment:9
<p>
I think this can be merged and geometry white-listed, and then <a class="closed ticket" href="https://trac.sagemath.org/ticket/25097" title="#25097: enhancement: Algebraic polyhedra with Normaliz / e-antic (closed: fixed)">#25097</a> can replace the test here when that ticket is ready.
</p>
TicketJean-Philippe LabbéWed, 12 Jun 2019 07:52:48 GMT
https://trac.sagemath.org/ticket/27965#comment:10
https://trac.sagemath.org/ticket/27965#comment:10
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/27965#comment:9" title="Comment 9">jhpalmieri</a>:
</p>
<blockquote class="citation">
<p>
I think this can be merged and geometry white-listed, and then <a class="closed ticket" href="https://trac.sagemath.org/ticket/25097" title="#25097: enhancement: Algebraic polyhedra with Normaliz / e-antic (closed: fixed)">#25097</a> can replace the test here when that ticket is ready.
</p>
</blockquote>
<p>
All right, sounds good!
</p>
<p>
I put the present ticket as dependancy in <a class="closed ticket" href="https://trac.sagemath.org/ticket/25097" title="#25097: enhancement: Algebraic polyhedra with Normaliz / e-antic (closed: fixed)">#25097</a>. The ticket is essentially ready and tested, it only gets slowed due to similar conflicts/dependancies, ;) that was the reason of my reserve.
</p>
TicketVolker BraunFri, 28 Jun 2019 04:30:30 GMTstatus, branch changed; resolution set
https://trac.sagemath.org/ticket/27965#comment:11
https://trac.sagemath.org/ticket/27965#comment:11
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>branch</strong>
changed from <em>u/jhpalmieri/27965</em> to <em>6fcdf0594952b6aa3234a75ef0d7137c84655583</em>
</li>
</ul>
TicketErik BrayWed, 03 Jul 2019 11:34:48 GMTmilestone changed
https://trac.sagemath.org/ticket/27965#comment:12
https://trac.sagemath.org/ticket/27965#comment:12
<ul>
<li><strong>milestone</strong>
changed from <em>sage-8.8</em> to <em>sage-8.9</em>
</li>
</ul>
<p>
Not in Sage 8.8. Let's please to try keep tickets' milestones related to the release in which we actually intend to include them, and in particular the release in which they were <em>actually</em> included, especially when closing tickets.
</p>
Ticket