import unittest from tudelft.utilities.immutablelist.FixedList import FixedList from unitpy.GeneralTests import GeneralTests from tudelft.utilities.immutablelist.JoinedList import JoinedList from typing import List class JoinedListTest(unittest.TestCase, GeneralTests[JoinedList[int]]): l1 = FixedList[int]([1]) l1a = FixedList([1]) l2 = FixedList([2]) join1 = JoinedList([l1, l1]) join1a = JoinedList([l1, l1a]) join2 = JoinedList([l1, l2]) join3 = JoinedList([l2, l1]) #Override def getGeneralTestData(self) -> List[List[JoinedList[int]]] : return [[self.join1, self.join1a], [self.join2], [self.join3]] #Override def getGeneralTestStrings(self)->List[str] : return ["\\[1,1\\]", "\\[1,2\\]", "\\[2,1\\]"] def testGet(self) : self.assertEqual( 2, self.join3.get(0)) self.assertEqual(1, self.join3.get(1)) def testSize(self): self.assertEqual(2, self.join3.size()) def testWith(self): join = self.join1.With(self.l2) self.assertEqual(3, join.size()) self.assertEqual(2, join.get(2))