source: utilitiespy/test/immutablelist/JoinedListTest.py@ 1031

Last change on this file since 1031 was 314, checked in by wouter, 3 years ago

#105 added JoinedList, MapList, Tuple, release 1.0.5

File size: 1.0 KB
RevLine 
[314]1import unittest
2from tudelft.utilities.immutablelist.FixedList import FixedList
3from unitpy.GeneralTests import GeneralTests
4from tudelft.utilities.immutablelist.JoinedList import JoinedList
5from typing import List
6
7class JoinedListTest(unittest.TestCase, GeneralTests[JoinedList[int]]):
8 l1 = FixedList[int]([1])
9 l1a = FixedList([1])
10 l2 = FixedList([2])
11
12 join1 = JoinedList([l1, l1])
13 join1a = JoinedList([l1, l1a])
14 join2 = JoinedList([l1, l2])
15 join3 = JoinedList([l2, l1])
16
17 #Override
18 def getGeneralTestData(self) -> List[List[JoinedList[int]]] :
19 return [[self.join1, self.join1a], [self.join2], [self.join3]]
20
21 #Override
22 def getGeneralTestStrings(self)->List[str] :
23 return ["\\[1,1\\]", "\\[1,2\\]", "\\[2,1\\]"]
24
25 def testGet(self) :
26 self.assertEqual( 2, self.join3.get(0))
27 self.assertEqual(1, self.join3.get(1))
28
29 def testSize(self):
30 self.assertEqual(2, self.join3.size())
31
32 def testWith(self):
33 join = self.join1.With(self.l2)
34 self.assertEqual(3, join.size())
35 self.assertEqual(2, join.get(2))
Note: See TracBrowser for help on using the repository browser.