source: utilitiespy/test/immutablelist/TuplesTest.py@ 1116

Last change on this file since 1116 was 1005, checked in by wouter, 3 months ago

#341 added Tuples, TuplesTest. redeployed

File size: 1.1 KB
RevLine 
[1005]1from random import random
2import unittest
3from tudelft.utilities.immutablelist.Tuple import Tuple
4from unitpy.GeneralTests import GeneralTests
5from tudelft.utilities.immutablelist.Tuples import Tuples
6from tudelft.utilities.immutablelist.FixedList import FixedList
7from tudelft.utilities.immutablelist.ImmutableList import ImmutableList
8from typing import List
9
10class TupleTest(unittest.TestCase, GeneralTests[Tuples]):
11
12 list1:ImmutableList[str] = FixedList(["a", "b"])
13 list2:ImmutableList[int] = FixedList([1, 2])
14 list3:ImmutableList[float] = FixedList([1.2, 1.5])
15
16 tuples1:Tuples = Tuples(list1, list2)
17 tuples1a:Tuples = Tuples(list1, list2)
18 tuples2:Tuples = Tuples(list1, list3)
19 tuples3:Tuples = Tuples(list2, list2)
20
21 def getGeneralTestData(self) -> List[List[Tuples]]:
22 return [[self.tuples1, self.tuples1a],[self.tuples2], [self.tuples3]]
23
24 def getGeneralTestStrings(self) -> List[str]:
25 return ["\\[\\<a,1\\>\\,\\<b,1\\>,\\<a,2\\>,\\<b,2\\>\\]",
26 "\\[\\<a,1.2\\>,\\<b,1.2\\>,\\<a,1.5\\>,\\<b,1.5\\>\\]",
27 "\\[\\<1,1\\>,\\<2,1\\>,\\<1,2\\>,\\<2,2\\>\\]"]
28
29
Note: See TracBrowser for help on using the repository browser.