Commit 0187be08 authored by Mark Dickinson's avatar Mark Dickinson

unparse.py: fix mispaced parentheses in chained comparisons

parent ce3742c6
...@@ -53,6 +53,10 @@ class UnparseTestCase(unittest.TestCase): ...@@ -53,6 +53,10 @@ class UnparseTestCase(unittest.TestCase):
self.check_roundtrip("not True or False") self.check_roundtrip("not True or False")
self.check_roundtrip("True or not False") self.check_roundtrip("True or not False")
def test_chained_comparisons(self):
self.check_roundtrip("1 < 4 <= 5")
self.check_roundtrip("a is b is c is not d")
def test_main(): def test_main():
test_support.run_unittest(UnparseTestCase) test_support.run_unittest(UnparseTestCase)
......
...@@ -388,7 +388,7 @@ class Unparser: ...@@ -388,7 +388,7 @@ class Unparser:
for o, e in zip(t.ops, t.comparators): for o, e in zip(t.ops, t.comparators):
self.write(" " + self.cmpops[o.__class__.__name__] + " ") self.write(" " + self.cmpops[o.__class__.__name__] + " ")
self.dispatch(e) self.dispatch(e)
self.write(")") self.write(")")
boolops = {_ast.And: 'and', _ast.Or: 'or'} boolops = {_ast.And: 'and', _ast.Or: 'or'}
def _BoolOp(self, t): def _BoolOp(self, t):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment