Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed tests

  • Loading branch information...
commit 0c95dca5a09bb18153f782a076a638e87163a316 1 parent 35fd38b
@rrenaud rrenaud authored
Showing with 17 additions and 8 deletions.
  1. +8 −0 card_info/__init__.py
  2. +6 −6 test_count_buys.py
  3. +3 −2 test_stats.py
View
8 card_info/__init__.py
@@ -61,6 +61,14 @@ def is_victory(singular_card_name):
def is_action(singular_card_name):
return _card_info_rows[singular_card_name]['Action'] == '1'
+def num_plus_actions(singular_card_name):
+ r = _card_info_rows[singular_card_name]['Actions']
+ try:
+ return int(r)
+ except ValueError:
+ # variable number of plus actions, just say 1
+ return 1
+
def num_copies_per_game(card_name, num_players):
if is_victory(card_name):
if num_players >= 3:
View
12 test_count_buys.py
@@ -14,12 +14,12 @@ def test_merge_buy_stat(self):
a.available.add_outcome(1)
b.available.add_outcome(3)
- self.assertEquals(a.available.frequency(), 1)
- self.assertEquals(b.available.frequency(), 1)
+ self.assertEquals(a.available.real_frequency(), 1)
+ self.assertEquals(b.available.real_frequency(), 1)
b.merge(a)
- self.assertEquals(b.available.frequency(), 2)
+ self.assertEquals(b.available.real_frequency(), 2)
def test_merge_deck_buy_stats(self):
a = count_buys.DeckBuyStats()
@@ -28,10 +28,10 @@ def test_merge_deck_buy_stats(self):
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)
+ self.assertEquals(a['Estate'].available.real_frequency(), 1)
+ self.assertEquals(b['Estate'].available.real_frequency(), 1)
b.merge(a)
- self.assertEquals(b['Estate'].available.frequency(), 2)
+ self.assertEquals(b['Estate'].available.real_frequency(), 2)
if __name__ == '__main__':
unittest.main()
View
5 test_stats.py
@@ -9,7 +9,8 @@ def test_simple(self):
# prior says 1 2p win, 1 2p loss # freq = 2, sum = 2, sum_sq = 4
d.add_outcome(2) # freq = 3, sum = 4, sum_sq = 8
d.add_outcome(3) # freq = 4, sum = 7, sum_sq = 17
- self.assertEquals(d.frequency(), 2)
+ self.assertEquals(d.real_frequency(), 2)
+ self.assertEquals(d.frequency(), 4)
self.assertEquals(d.mean(), 7. / 4)
self.assertEquals(d.variance(), (17 - 49. / 4) / 3)
@@ -22,7 +23,7 @@ def test_merge(self):
b.merge(a)
- self.assertEquals(b.frequency(), 2)
+ self.assertEquals(b.real_frequency(), 2)
if __name__ == '__main__':
Please sign in to comment.
Something went wrong with that request. Please try again.