From: Benjamin Peterson Date: Sat, 31 Oct 2009 03:56:15 +0000 (+0000) Subject: add some checks for evaluation order with parenthesis #7210 X-Git-Tag: v2.7a1~186 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2e31a1c63aee016fe457f9328c30d74b746429f;p=thirdparty%2FPython%2Fcpython.git add some checks for evaluation order with parenthesis #7210 --- diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 27966ed58284..f144ae782e5a 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -966,6 +966,14 @@ hello world self.assertEqual((6 / 2 if 1 else 3), 3) self.assertEqual((6 < 4 if 0 else 2), 2) + def test_paren_evaluation(self): + self.assertEqual(16 // (4 // 2), 8) + self.assertEqual((16 // 4) // 2, 2) + self.assertEqual(16 // 4 // 2, 2) + self.assertTrue(False is (2 is 3)) + self.assertFalse((False is 2) is 3) + self.assertFalse(False is 2 is 3) + def test_main(): run_unittest(TokenTests, GrammarTests)