Skip to content

Commit

Permalink
Add more tests for nth_combination
Browse files Browse the repository at this point in the history
  • Loading branch information
bbayles committed Jul 15, 2018
1 parent 7041f0a commit d8d96ca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions more_itertools/tests/test_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,15 @@ def test_long(self):
expected = (2, 12, 35, 126)
self.assertEqual(actual, expected)

def test_invalid_r(self):
for r in (-1, 3):
with self.assertRaises(ValueError):
mi.nth_combination([], r, 0)

def test_invalid_index(self):
with self.assertRaises(IndexError):
mi.nth_combination('abcdefg', 3, -36)


class PrependTests(TestCase):
def test_basic(self):
Expand Down

0 comments on commit d8d96ca

Please sign in to comment.