1 | import unittest
|
---|
2 | from geniusweb.issuevalue.DiscreteValue import DiscreteValue
|
---|
3 | from decimal import Decimal
|
---|
4 | from typing import Set, Dict
|
---|
5 | from geniusweb.issuevalue.DiscreteValueSet import DiscreteValueSet
|
---|
6 | from geniusweb.profile.utilityspace.DiscreteValueSetUtilities import DiscreteValueSetUtilities
|
---|
7 | from geniusweb.bidspace.IssueInfo import IssueInfo
|
---|
8 | from geniusweb.bidspace.Interval import Interval
|
---|
9 |
|
---|
10 | class IssueInfoTest(unittest.TestCase):
|
---|
11 |
|
---|
12 | NAME = "name"
|
---|
13 | VAL1 = DiscreteValue("v1")
|
---|
14 | VAL2 = DiscreteValue("v2")
|
---|
15 | VAL3 = DiscreteValue("v3")
|
---|
16 | N03 = Decimal("0.3")
|
---|
17 | N04 = Decimal("0.4")
|
---|
18 | N05 = Decimal("0.5")
|
---|
19 | N06 = Decimal("0.6")
|
---|
20 |
|
---|
21 | def setUp(self) :
|
---|
22 | issuevalues:Set[DiscreteValue] = set()
|
---|
23 | issuevalues.add(self.VAL1)
|
---|
24 | issuevalues.add(self.VAL2)
|
---|
25 | issuevalues.add(self.VAL3)
|
---|
26 | values = DiscreteValueSet(issuevalues)
|
---|
27 | valueUtils:Dict[DiscreteValue,Decimal] = {}
|
---|
28 | valueUtils[self.VAL1]= self.N03
|
---|
29 | valueUtils[self.VAL2]= self.N04
|
---|
30 | valueUtils[self.VAL3]= self.N05
|
---|
31 | utils = DiscreteValueSetUtilities(valueUtils)
|
---|
32 | self.info = IssueInfo(self.NAME, values, utils, self.N06, 6)
|
---|
33 |
|
---|
34 | def testsmokeTest(self):
|
---|
35 | pass
|
---|
36 |
|
---|
37 | def testGetExtremeMin(self):
|
---|
38 | self.assertEqual(self.VAL1, self.info.getExtreme(False))
|
---|
39 | self.assertEqual(self.VAL3, self.info.getExtreme(True))
|
---|
40 |
|
---|
41 | def testgetNameTest(self):
|
---|
42 | self.assertEqual(self.NAME, self.info.getName())
|
---|
43 |
|
---|
44 | def testgetIntervalTest(self):
|
---|
45 | self.assertEqual(Interval(self.N03*self.N06, self.N05*self.N06),
|
---|
46 | self.info.getInterval())
|
---|