forked from rspeer/dominionstats
-
Notifications
You must be signed in to change notification settings - Fork 17
/
test_count_buys.py
34 lines (26 loc) · 898 Bytes
/
test_count_buys.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
#!/usr/bin/python
# -*- coding: utf-8 -*-
try:
import unittest2 as unittest
except ImportError, e:
import unittest
import count_buys
class TestBuyStats(unittest.TestCase):
def test_merge_buy_stat(self):
a = count_buys.BuyStat()
b = count_buys.BuyStat()
a.available.add_outcome(1)
b.available.add_outcome(3)
b.merge(a)
self.assertEquals(b.available.mean(), 4.0/2.0)
def test_merge_deck_buy_stats(self):
a = count_buys.DeckBuyStats()
b = count_buys.DeckBuyStats()
a['Estate'].available.add_outcome(2)
b['Estate'].available.add_outcome(0)
self.assertEquals(a['Estate'].available.frequency(), 1)
self.assertEquals(b['Estate'].available.frequency(), 1)
b.merge(a)
self.assertEquals(b['Estate'].available.frequency(), 2)
if __name__ == '__main__':
unittest.main()