fix keyword calling

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-11-27 20:32:21 +01:00
parent bb755ae009
commit 56c1391a16
3 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Changes between 1.1.2 and 1.1.1
=====================================
- fix assert reinterpreation that sees a call containing "keyword=..."
Changes between 1.1.1 and 1.1.0
=====================================

View File

@ -234,7 +234,7 @@ class DebugInterpreter(ast.NodeVisitor):
arg_explanation, arg_result = self.visit(keyword.value)
arg_name = "__exprinfo_%s" % (len(ns),)
ns[arg_name] = arg_result
keyword_source = "%s=%%s" % (keyword.id)
keyword_source = "%s=%%s" % (keyword.arg)
arguments.append(keyword_source % (arg_name,))
arg_explanations.append(keyword_source % (arg_explanation,))
if call.starargs:

View File

@ -93,6 +93,14 @@ def test_assert_non_string_message():
e = exvalue()
assert e.msg == "hello"
def test_assert_keyword_arg():
def f(x=3):
return False
try:
assert f(x=5)
except AssertionError:
e = exvalue()
assert "x=5" in e.msg
# These tests should both fail, but should fail nicely...
class WeirdRepr: