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):
194
194
...
195
195
IndexError: index i (=1) is greater than or equal to the cardinality
196
196
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
+
197
210
Verify that :issue:`39534` has been fixed::
198
211
199
212
sage: T = Tuples(range(3), 30).random_element()
@@ -209,7 +222,7 @@ def unrank(self, i):
209
222
raise IndexError ("index i (={}) is greater than or equal to the cardinality"
210
223
.format (i ))
211
224
ts = len (self .S )
212
- if ts = = 1 :
225
+ if ts < = 1 :
213
226
return tuple (self .S [0 ] for _ in range (self .k ))
214
227
return tuple (i .digits (ts , self .S , self .k ))
215
228
You can’t perform that action at this time.
0 commit comments