Skip to content

Commit 1711cdc

Browse files
author
Noel Roemmele
committed
Added test to confirm that unrank works when k = 0.
1 parent 7812951 commit 1711cdc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/sage/combinat/tuple.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@ def unrank(self, i):
182182
sage: T[0]
183183
(1, 1, 1, 1, 1)
184184
185+
Verify that :meth:`unrank` gives the correct answer when `k = 0`::
186+
187+
sage: T = Tuples(range(6), 0)
188+
sage: list(T)
189+
[()]
190+
sage: T[0]
191+
()
192+
sage: T[1]
193+
Traceback (most recent call last):
194+
...
195+
IndexError: index i (=1) is greater than or equal to the cardinality
196+
185197
Verify that :issue:`39534` has been fixed::
186198
187199
sage: T = Tuples(range(3), 30).random_element()

0 commit comments

Comments
 (0)