diff --git a/CHANGELOG b/CHANGELOG index 9e5cd8381..bbeac5baa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 ===================================== diff --git a/py/impl/code/_assertionnew.py b/py/impl/code/_assertionnew.py index c847ddc59..c80902088 100644 --- a/py/impl/code/_assertionnew.py +++ b/py/impl/code/_assertionnew.py @@ -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: diff --git a/testing/code/test_assertion.py b/testing/code/test_assertion.py index 009a6a302..ba9c9de76 100644 --- a/testing/code/test_assertion.py +++ b/testing/code/test_assertion.py @@ -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: