示例#1
0
    def test_integerListInsert_whenIndexIsInvalid_shouldRaise(self):
        il = IntegerList(1, 2, 3, 4, 5, 6, 7)

        with self.assertRaises(Exception) as context:
            il.insert(len(il.get_data()), -1)

        self.assertIsNotNone(context.exception)
示例#2
0
    def test_integerListInsert_whenValueIsNotInteger_shouldRaise(self):
        il = IntegerList(1, 2, 3, 4, 5, 6, 7)

        with self.assertRaises(Exception) as context:
            il.insert(0, True)

        self.assertIsNotNone(context.exception)
示例#3
0
    def test_integerListInsert_whenIndexIsValid_shouldInsertIt(self):
        il = IntegerList(1, 2, 3, 4, 5, 6, 7)
        il.insert(2, -1)

        self.assertListEqual([1, 2, -1, 3, 4, 5, 6, 7], il.get_data())