Fix a typo in assertion rewriting.
This commit is contained in:
parent
8cd68494bf
commit
6096aeca53
|
@ -421,7 +421,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
if chain:
|
if chain:
|
||||||
where = []
|
where = []
|
||||||
if len(chain) > 1:
|
if len(chain) > 1:
|
||||||
cond = ast.Boolop(ast.And(), chain)
|
cond = ast.BoolOp(ast.And(), list(chain))
|
||||||
else:
|
else:
|
||||||
cond = chain[0]
|
cond = chain[0]
|
||||||
self.statements.append(ast.If(cond, where, []))
|
self.statements.append(ast.If(cond, where, []))
|
||||||
|
|
|
@ -138,6 +138,12 @@ class TestAssertionRewrite:
|
||||||
assert f or g
|
assert f or g
|
||||||
getmsg(f, must_pass=True)
|
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 test_short_circut_evaluation(self):
|
||||||
def f():
|
def f():
|
||||||
assert True or explode
|
assert True or explode
|
||||||
|
|
Loading…
Reference in New Issue