forked from JyotsnaGorle/jeeves
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_strategist.py
40 lines (30 loc) · 909 Bytes
/
test_strategist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from strategist.strategist import Strategist
import unittest
class BaseStrategy:
def describe(self):
pass
def perform(self):
pass
class PlayMusic(BaseStrategy): pass
class StartTV(BaseStrategy): pass
class OpenFacebook(BaseStrategy): pass
strategies = {
"feel": {
"bored": [PlayMusic(), StartTV()],
"lonely": [OpenFacebook()]
},
"need": {
"music": [PlayMusic()]
}
}
class StrategistTestCase(unittest.TestCase):
def setUp(self):
self.strategist = Strategist(strategies)
def tearDown(self):
del self.strategist
def test_should_return_list_of_strategies(self):
expected_list = self.strategist.get_strategy_for("feel", "bored")
self.assertTrue(isinstance(expected_list[0], PlayMusic))
self.assertTrue(isinstance(expected_list[1], StartTV))
if __name__ == '__main__':
unittest.main()