Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion largest-series-product/largest_series_product_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,26 @@ def test_big_number(self):
series = "52677741234314237566414902593461595376319419139427"
self.assertEqual(28350, largest_product(series, 6))

def test_identity(self):
def test_string_with_all_zeroes(self):
self.assertEqual(0, largest_product("0000", 2))

def test_string_where_all_spans_contain_zero(self):
self.assertEqual(0, largest_product("99099", 3))

def test_identity_with_empty_string(self):
self.assertEqual(1, largest_product("", 0))

def test_identity_with_nonempty_string(self):
self.assertEqual(1, largest_product("123", 0))

def test_slices_bigger_than_number(self):
with self.assertRaises(ValueError):
largest_product("012", 4)

def test_nonzero_slice_size_and_empty_string(self):
with self.assertRaises(ValueError):
largest_product("", 1)


if __name__ == '__main__':
unittest.main()