コード例 #1
0
 def test_dstring_tokenize_whitespace_1d6_2(self):
     self.assertEqual(dice.dstring_tokenize("1d6  +2"), ["1d6", "+", "2"])
コード例 #2
0
 def test_dstring_tokenize_invalid_token_too_many_d(self):
     with self.assertRaisesRegex(ValueError, "Invalid token '.*' in .*"):
         dice.dstring_tokenize("1dd6")
コード例 #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")
コード例 #4
0
 def test_dstring_tokenize_xdx_plus_xdx_minus_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d4+1d6-1d8"),
                      ["1d4", "+", "1d6", "-", "1d8"])
コード例 #5
0
 def test_dstring_tokenize_invalid_dstring(self):
     with self.assertRaisesRegex(ValueError, "Invalid character .* in .*"):
         dice.dstring_tokenize("1f20-1d4")
コード例 #6
0
 def test_dstring_tokenize_xdx_minus_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d20-1d4"),
                      ["1d20", "-", "1d4"])
コード例 #7
0
 def test_dstring_tokenize_xdx_plus_xdx(self):
     self.assertEqual(dice.dstring_tokenize("1d10+1d8"),
                      ["1d10", "+", "1d8"])
コード例 #8
0
 def test_dstring_tokenize_xdx_minus_x(self):
     self.assertEqual(dice.dstring_tokenize("1d6-1"), ["1d6", "-", "1"])
コード例 #9
0
 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"])