Skip to content

Commit

Permalink
Merge pull request #222 from erikrose/nth_combination_tests
Browse files Browse the repository at this point in the history
Add more tests for nth_combination
  • Loading branch information
bbayles committed Jul 15, 2018
2 parents 7041f0a + d8d96ca commit ac8c103
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 ac8c103

Please sign in to comment.