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)
def test_insert(self, index): baseList = [0] * 15 newCSRCList = CSRCList(baseList) newCSRCList.insert(index, 1) baseList.insert(index, 1) self.assertEqual(newCSRCList, baseList)
def test_csrc_max_extend(self, value): maxCSRCList = CSRCList(value) appendLen = 16 - len(maxCSRCList) with self.assertRaises(LengthError): maxCSRCList.extend([0] * appendLen)
def test_csrc_max_append(self): maxCSRCList = CSRCList([0] * 15) self.assertEqual(len(maxCSRCList), 15) with self.assertRaises(LengthError): maxCSRCList.append(0)
def test_csrc_init_too_big(self, value): with self.assertRaises(LengthError): CSRCList(value)
def test_csrc_init(self, value): newCSRCList = CSRCList(value) self.assertEqual(newCSRCList, value)
def setUp(self): self.thisCSRCList = CSRCList()
def test_csrcList_default(self): self.assertEqual(self.thisRTP.csrcList, CSRCList())