summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-10-31 03:56:15 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-10-31 03:56:15 (GMT)
commitb2e31a1c63aee016fe457f9328c30d74b746429f (patch)
tree17e0514e400e7c78ff68ee4ce4fb1327666d96ab /Lib
parent2c970a2ba23eb578923771922b0da2344385c137 (diff)
downloadcpython-b2e31a1c63aee016fe457f9328c30d74b746429f.zip
cpython-b2e31a1c63aee016fe457f9328c30d74b746429f.tar.gz
cpython-b2e31a1c63aee016fe457f9328c30d74b746429f.tar.bz2
add some checks for evaluation order with parenthesis #7210
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_grammar.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 27966ed..f144ae7 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)