changeset 521:71219011e19c

changed tests again since I changed the output results of the new roller to match the output of the old roller
author digitalxero
date Fri, 19 Mar 2010 18:47:25 -0600
parents d011d222b4fc
children cb99e2865f80
files orpg/tests/test_dieroller.py
diffstat 1 files changed, 10 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/tests/test_dieroller.py	Fri Mar 19 18:41:55 2010 -0600
+++ b/orpg/tests/test_dieroller.py	Fri Mar 19 18:47:25 2010 -0600
@@ -11,20 +11,7 @@
             metafunc.addcall(funcargs=funcargs)
 
 class TestDiceRolls:
-    params = {
-        'test_roll': [
-            [dict(roll='1d20', min_roll=1, max_roll=20) for x in xrange(100)],
-            [dict(roll='1d20.minroll(5)', min_roll=5,
-                 max_roll=20) for x in xrange(100)],
-            [dict(roll='4d6.each(5)', min_roll=1, max_roll=6,
-                 num_results=8, extra=5) for x in xrange(100)],
-            [dict(roll='4d6.takeHighest(3)', min_roll=1, num_results=3,
-                 max_roll=6) for x in xrange(100)],
-            [dict(roll='(1+2+1)d6.takeHighest(3)', min_roll=1, num_results=3,
-                 max_roll=6) for x in xrange(100)],
-            [dict(roll='4d6.takeHighest(3).minroll(3)', min_roll=3,
-                 num_results=3, max_roll=6) for x in xrange(100)]],
-        'test_old_roll': [
+    _tests = [
             [dict(roll='1d20', min_roll=1, max_roll=20) for x in xrange(100)],
             [dict(roll='1d20.minroll(5)', min_roll=5,
                  max_roll=20) for x in xrange(100)],
@@ -35,7 +22,10 @@
             [dict(roll='(1+2+1)d6.takeHighest(3)', min_roll=1, num_results=3,
                  max_roll=6) for x in xrange(100)],
             [dict(roll='4d6.takeHighest(3).minroll(3)', min_roll=3,
-                 num_results=3, max_roll=6) for x in xrange(100)]],
+                 num_results=3, max_roll=6) for x in xrange(100)]]
+    params = {
+        'test_roll': _tests,
+        'test_old_roll': _tests,
     }
 
     def test_roll(self, roll, min_roll, max_roll, num_results=1, extra=None):
@@ -47,7 +37,11 @@
         assert isinstance(results, list)
         assert len(results) == num_results
         for r in results:
-            assert r >= min_roll and r <= max_roll
+            if extra is not None:
+                assert r[0] >= min_roll and r[0] <= max_roll
+                assert r[1] == extra
+            else:
+                assert r >= min_roll and r <= max_roll
 
     def test_old_roll(self, roll, min_roll, max_roll, num_results=1, extra=None):
         from orpg.dieroller import roller_manager