def test_dstring_tokenize_whitespace_1d6_2(self):
     self.assertEqual(dice.dstring_tokenize("1d6  +2"), ["1d6", "+", "2"])
 def test_dstring_tokenize_invalid_token_too_many_d(self):
     with self.assertRaisesRegex(ValueError, "Invalid token '.*' in .*"):
         dice.dstring_tokenize("1dd6")
 def test_dstring_tokenize_invalid_token_too_many_operators(self):
     with self.assertRaisesRegex(ValueError,
                                 "Invalid token in .*, check operators"):
         dice.dstring_tokenize("1d6+-1d6")
 def test_dstring_tokenize_xdx_plus_xdx_minus_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d4+1d6-1d8"),
                      ["1d4", "+", "1d6", "-", "1d8"])
 def test_dstring_tokenize_invalid_dstring(self):
     with self.assertRaisesRegex(ValueError, "Invalid character .* in .*"):
         dice.dstring_tokenize("1f20-1d4")
 def test_dstring_tokenize_xdx_minus_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d20-1d4"),
                      ["1d20", "-", "1d4"])
 def test_dstring_tokenize_xdx_plus_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d10+1d8"),
                      ["1d10", "+", "1d8"])
 def test_dstring_tokenize_xdx_minus_x(self):
     self.assertEqual(dice.dstring_tokenize("1d6-1"), ["1d6", "-", "1"])
 def test_dstring_tokenize_xdx_plus_x(self):
     self.assertEqual(dice.dstring_tokenize("1d6+1"), ["1d6", "+", "1"])
示例#10
0
 def test_dstring_tokenize_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d6"), ["1d6"])