# HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User Benjamin Peterson <benja...@python.org> # Date 1276113191 18000 # Node ID 03efb9888f2689bfd53f70fcf4b15a14493b3d05 # Parent a08c18e10a49ee9ce232a623054dab780d5a2e76 Interpret assignments while examining asserts corrects
fixes #105 --- a/py/_code/_assertionnew.py +++ b/py/_code/_assertionnew.py @@ -324,10 +324,11 @@ class DebugInterpreter(ast.NodeVisitor): def visit_Assign(self, assign): value_explanation, value_result = self.visit(assign.value) explanation = "... = %s" % (value_explanation,) - name = ast.Name("__exprinfo_expr", ast.Load(), assign.value.lineno, - assign.value.col_offset) - new_assign = ast.Assign(assign.targets, name, assign.lineno, - assign.col_offset) + name = ast.Name("__exprinfo_expr", ast.Load(), + lineno=assign.value.lineno, + col_offset=assign.value.col_offset) + new_assign = ast.Assign(assign.targets, name, lineno=assign.lineno, + col_offset=assign.col_offset) mod = ast.Module([new_assign]) co = self._compile(mod, "exec") try: --- a/testing/code/test_assertion.py +++ b/testing/code/test_assertion.py @@ -139,6 +139,13 @@ def test_assert_with_brokenrepr_arg(): if e.msg.find("broken __repr__") == -1: py.test.fail("broken __repr__ not handle correctly") +def test_multiple_statements_per_line(): + try: + a = 1; assert a == 2 + except AssertionError: + e = exvalue() + assert "assert 1 == 2" in e.msg + class TestView: --- a/CHANGELOG +++ b/CHANGELOG @@ -34,6 +34,7 @@ New features Bug fixes / Maintenance ++++++++++++++++++++++++++ +- fix issue105 assignment on the same line as a failing assertion - fix issue104 proper escaping for test names in junitxml plugin - fix issue57 -f|--looponfail to work with xpassing tests - fix pyimport() to work with directories _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn