fix assertion rewriting on calls with a double-star arg
This commit is contained in:
parent
85415135a4
commit
7576b3c7d0
|
@ -1,6 +1,7 @@
|
|||
Changes between 2.1.0 and 2.1.1.DEV
|
||||
----------------------------------------------
|
||||
|
||||
- fix assertion rewriting on calls with a ** arg
|
||||
- don't cache rewritten modules if bytecode generation is disabled
|
||||
- fix assertion rewriting in read-only directories
|
||||
- fix issue59: provide system-out/err tags for junitxml output
|
||||
|
|
|
@ -514,7 +514,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
|||
new_star, expl = self.visit(call.starargs)
|
||||
arg_expls.append("*" + expl)
|
||||
if call.kwargs:
|
||||
new_kwarg, expl = self.visit(call.kwarg)
|
||||
new_kwarg, expl = self.visit(call.kwargs)
|
||||
arg_expls.append("**" + expl)
|
||||
expl = "%s(%s)" % (func_expl, ', '.join(arg_expls))
|
||||
new_call = ast.Call(new_func, new_args, new_kwargs, new_star, new_kwarg)
|
||||
|
|
|
@ -195,6 +195,10 @@ class TestAssertionRewrite:
|
|||
def f():
|
||||
assert g(1, 3, g=23)
|
||||
assert getmsg(f, ns) == """assert g(1, 3, g=23)"""
|
||||
def f():
|
||||
x = "a"
|
||||
assert g(**{x : 2})
|
||||
assert getmsg(f, ns) == """assert g(**{'a': 2})"""
|
||||
|
||||
def test_attribute(self):
|
||||
class X(object):
|
||||
|
|
Loading…
Reference in New Issue