[1005] | 1 | from random import random
|
---|
| 2 | import unittest
|
---|
| 3 | from tudelft.utilities.immutablelist.Tuple import Tuple
|
---|
| 4 | from unitpy.GeneralTests import GeneralTests
|
---|
| 5 | from tudelft.utilities.immutablelist.Tuples import Tuples
|
---|
| 6 | from tudelft.utilities.immutablelist.FixedList import FixedList
|
---|
| 7 | from tudelft.utilities.immutablelist.ImmutableList import ImmutableList
|
---|
| 8 | from typing import List
|
---|
| 9 |
|
---|
| 10 | class 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 | |
---|