File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,19 @@ def unrank(self, i):
194194 ...
195195 IndexError: index i (=1) is greater than or equal to the cardinality
196196
197+ Verify that :meth:`unrank` gives the correct answer when `|S| < 1` and
198+ `k = 0`::
199+
200+ sage: T = Tuples(range(0), 0)
201+ sage: T[0]
202+ ()
203+ sage: T[-1]
204+ ()
205+ sage: T[1]
206+ Traceback (most recent call last):
207+ ...
208+ IndexError: index i (=1) is greater than or equal to the cardinality
209+
197210 Verify that :issue:`39534` has been fixed::
198211
199212 sage: T = Tuples(range(3), 30).random_element()
@@ -209,7 +222,7 @@ def unrank(self, i):
209222 raise IndexError ("index i (={}) is greater than or equal to the cardinality"
210223 .format (i ))
211224 ts = len (self .S )
212- if ts = = 1 :
225+ if ts < = 1 :
213226 return tuple (self .S [0 ] for _ in range (self .k ))
214227 return tuple (i .digits (ts , self .S , self .k ))
215228
You can’t perform that action at this time.
0 commit comments