Пример #1
0
 def test_that_int_sequence_fails_on_illegal_values(self):
     ints = int_sequence("4-2")
Пример #2
0
    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]))
Пример #3
0
 def test_that_int_sequence_fails_on_malformed_sequence(self):
     ints = int_sequence("-23")
Пример #4
0
    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]))
Пример #5
0
    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)))
Пример #6
0
 def test_that_int_sequence_fails_on_illegal_values(self):
     ints = int_sequence("4-2")
Пример #7
0
    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)
Пример #8
0
 def test_that_int_sequence_fails_on_malformed_sequence(self):
     ints = int_sequence("-23")
Пример #9
0
    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]))
Пример #10
0
    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)))
Пример #11
0
    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]))
Пример #12
0
    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)