source: geniuswebcore/test/geniusweb/bidspace/IssueInfoTest.py@ 88

Last change on this file since 88 was 88, checked in by Bart Vastenhouw, 3 years ago

Added python SimpleRunner GUI

File size: 1.4 KB
Line 
1import unittest
2from geniusweb.issuevalue.DiscreteValue import DiscreteValue
3from decimal import Decimal
4from typing import Set, Dict
5from geniusweb.issuevalue.DiscreteValueSet import DiscreteValueSet
6from geniusweb.profile.utilityspace.DiscreteValueSetUtilities import DiscreteValueSetUtilities
7from geniusweb.bidspace.IssueInfo import IssueInfo
8from geniusweb.bidspace.Interval import Interval
9
10class 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())
Note: See TracBrowser for help on using the repository browser.