def test_that_int_sequence_fails_on_illegal_values(self): ints = int_sequence("4-2")
def test_that_int_sequence_processes_mixed_ranges_and_ints(self): ints = int_sequence("1-3,5,7-9,12") assert_true(isinstance(ints, list)) assert_equal(len(ints), 8) assert_equal(set(ints), set([1, 2, 3, 5, 7, 8, 9, 12]))
def test_that_int_sequence_fails_on_malformed_sequence(self): ints = int_sequence("-23")
def test_that_int_sequence_processes_several_ints(self): ints = int_sequence("3, 4, 6, 123, 345") assert_true(isinstance(ints, list)) assert_equal(len(ints), 5) assert_equal(set(ints), set([3, 4, 6, 123, 345]))
def test_that_int_sequence_proccesses_simple_ranges(self): ints = int_sequence("0-5") assert_true(isinstance(ints, list)) assert_equal(len(ints), 6) assert_equal(set(ints), set(range(0, 6)))
def test_that_int_sequence_processes_single_int(self): ints = int_sequence("3") assert_true(isinstance(ints, list)) assert_equal(len(ints), 1) assert_equal(ints[0], 3)