Skip to content

Commit 1443c52

Browse files
committed
ManifoldTable: Fix bug where OrientableCuspedCensus(tets=3)[100:] would return a non-empty list.
1 parent 8f0ea5d commit 1443c52

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

src/snappy/database.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ def __getitem__(self, index):
221221
base_query += 'where %s ' % self._filter
222222
query = base_query + 'order by id limit 1 offset %d' % start
223223
start_id = self._cursor.execute(query).fetchone()
224-
if start_id is not None:
224+
if start_id is None:
225+
conditions.append('false')
226+
else:
225227
conditions.append('id >= %d' % start_id[0])
226228
query = base_query + 'order by id limit 1 offset %d' % stop
227229
stop_id = self._cursor.execute(query).fetchone()

src/snappy/tests/misc.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,35 @@
7474
>>> 'singularity_index' in c.keys()
7575
False
7676
77+
ManifoldTable
78+
-------------
79+
80+
>>> len(OrientableCuspedCensus(tets=3))
81+
9
82+
>>> len(OrientableCuspedCensus(tets=3)[0:3])
83+
3
84+
>>> len(OrientableCuspedCensus(tets=3)[1:3])
85+
2
86+
>>> list(OrientableCuspedCensus(tets=3)[1:3])
87+
[m007(0,0), m009(0,0)]
88+
>>> list(OrientableCuspedCensus(tets=3)[4:])
89+
[m011(0,0), m015(0,0), m016(0,0), m017(0,0), m019(0,0)]
90+
>>> list(OrientableCuspedCensus(tets=3)[4:][1:3])
91+
[m015(0,0), m016(0,0)]
92+
>>> list(OrientableCuspedCensus(tets=3)[4:100])
93+
[m011(0,0), m015(0,0), m016(0,0), m017(0,0), m019(0,0)]
94+
>>> list(OrientableCuspedCensus(tets=3)[100:])
95+
[]
96+
7797
"""
7898

7999
if not __doc__:
80100
raise Exception("doc string with tests was not recognized.")
81101

82-
from .. import Manifold, ManifoldHP, Triangulation, TriangulationHP, NonorientableCuspedCensus
102+
from .. import (
103+
Manifold, ManifoldHP,
104+
Triangulation, TriangulationHP,
105+
OrientableCuspedCensus, NonorientableCuspedCensus)
83106

84107
def my_cusp_orientabilities(T):
85108
T._testing_compute_cusp_orientabilities()

0 commit comments

Comments
 (0)