Beispiel #1
0
    def test_insert(self, index):
        baseList = [0] * 15
        newCSRCList = CSRCList(baseList)
        newCSRCList.insert(index, 1)

        baseList.insert(index, 1)
        self.assertEqual(newCSRCList, baseList)
Beispiel #2
0
    def test_insert_invalid(self):
        baseList = [0] * 15
        newCSRCList = CSRCList(baseList)

        with self.assertRaises(IndexError):
            newCSRCList.insert(-1, 1)

        with self.assertRaises(IndexError):
            newCSRCList.insert(len(baseList), 1)

        baseList = [0] * 13
        newCSRCList = CSRCList(baseList)

        with self.assertRaises(IndexError):
            newCSRCList.insert(15, 1)