]> granicus.if.org Git - python/commitdiff
Merged revisions 82345 via svnmerge from
authorMark Dickinson <dickinsm@gmail.com>
Mon, 28 Jun 2010 20:09:18 +0000 (20:09 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Mon, 28 Jun 2010 20:09:18 +0000 (20:09 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82345 | mark.dickinson | 2010-06-28 20:54:19 +0100 (Mon, 28 Jun 2010) | 1 line

  unparse.py:  fix mispaced parentheses in chained comparisons
........

Demo/parser/test_unparse.py
Demo/parser/unparse.py

index aa6f2704effa4615b42932f49d1c15509d7b8052..edc9ee16f17b98657e664f633bc15486387ca71a 100644 (file)
@@ -53,6 +53,10 @@ class UnparseTestCase(unittest.TestCase):
         self.check_roundtrip("not True or 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():
     test.support.run_unittest(UnparseTestCase)
index b02ef75db5b01e6047d9bdd85eb5af1362b5ee7b..0d62e54ef6f0320527c760eef8b8dd1ff64203c9 100644 (file)
@@ -379,7 +379,7 @@ class Unparser:
         for o, e in zip(t.ops, t.comparators):
             self.write(" " + self.cmpops[o.__class__.__name__] + " ")
             self.dispatch(e)
-            self.write(")")
+        self.write(")")
 
     boolops = {_ast.And: 'and', _ast.Or: 'or'}
     def _BoolOp(self, t):