Esempio n. 1
0
 def test_dstring_tokenize_whitespace_1d6_2(self):
     self.assertEqual(dice.dstring_tokenize("1d6  +2"), ["1d6", "+", "2"])
Esempio n. 2
0
 def test_dstring_tokenize_invalid_token_too_many_d(self):
     with self.assertRaisesRegex(ValueError, "Invalid token '.*' in .*"):
         dice.dstring_tokenize("1dd6")
Esempio n. 3
0
 def test_dstring_tokenize_invalid_token_too_many_operators(self):
     with self.assertRaisesRegex(ValueError,
                                 "Invalid token in .*, check operators"):
         dice.dstring_tokenize("1d6+-1d6")
Esempio n. 4
0
 def test_dstring_tokenize_xdx_plus_xdx_minus_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d4+1d6-1d8"),
                      ["1d4", "+", "1d6", "-", "1d8"])
Esempio n. 5
0
 def test_dstring_tokenize_invalid_dstring(self):
     with self.assertRaisesRegex(ValueError, "Invalid character .* in .*"):
         dice.dstring_tokenize("1f20-1d4")
Esempio n. 6
0
 def test_dstring_tokenize_xdx_minus_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d20-1d4"),
                      ["1d20", "-", "1d4"])
Esempio n. 7
0
 def test_dstring_tokenize_xdx_plus_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d10+1d8"),
                      ["1d10", "+", "1d8"])
Esempio n. 8
0
 def test_dstring_tokenize_xdx_minus_x(self):
     self.assertEqual(dice.dstring_tokenize("1d6-1"), ["1d6", "-", "1"])
Esempio n. 9
0
 def test_dstring_tokenize_xdx_plus_x(self):
     self.assertEqual(dice.dstring_tokenize("1d6+1"), ["1d6", "+", "1"])
Esempio n. 10
0
 def test_dstring_tokenize_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d6"), ["1d6"])