diff options
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r-- | Lib/test/test_grammar.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 70d85b1..0c65858 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -1,7 +1,7 @@ # Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. -from test.support import run_unittest, check_syntax_error +from test.support import check_syntax_error import unittest import sys # testing import * @@ -1016,9 +1016,20 @@ class GrammarTests(unittest.TestCase): self.assertFalse((False is 2) is 3) self.assertFalse(False is 2 is 3) + def test_matrix_mul(self): + # This is not intended to be a comprehensive test, rather just to be few + # samples of the @ operator in test_grammar.py. + class M: + def __matmul__(self, o): + return 4 + def __imatmul__(self, o): + self.other = o + return self + m = M() + self.assertEqual(m @ m, 4) + m @= 42 + self.assertEqual(m.other, 42) -def test_main(): - run_unittest(TokenTests, GrammarTests) if __name__ == '__main__': - test_main() + unittest.main() |