Commits

Michał Bartoszkiewicz committed babc469

Fix a typo in assertion rewriting.

Comments (0)

Files changed (2)

_pytest/assertion/rewrite.py

             if chain:
                 where = []
                 if len(chain) > 1:
-                    cond = ast.Boolop(ast.And(), chain)
+                    cond = ast.BoolOp(ast.And(), list(chain))
                 else:
                     cond = chain[0]
                 self.statements.append(ast.If(cond, where, []))

testing/test_assertrewrite.py

             assert f or g
         getmsg(f, must_pass=True)
 
+    def test_long_chain(self):
+        def f():
+            f = g = h = lambda: True
+            assert f() and g() and h()
+        getmsg(f, must_pass=True)
+
     def test_short_circut_evaluation(self):
         def f():
             assert True or explode