[py-svn] py-trunk commit 9fae04a6b042: fix assertion interpretation when the operator is **

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Jun 10 20:49:46 CEST 2010


# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview
# User Benjamin Peterson <benjamin at python.org>
# Date 1276195807 18000
# Node ID 9fae04a6b042bacaf8579809eb043db788850134
# Parent  01bdefcb53f1050b9a742c71c69a295f30787560
fix assertion interpretation when the operator is **

--- a/py/_code/_assertionnew.py
+++ b/py/_code/_assertionnew.py
@@ -92,6 +92,7 @@ operator_map = {
     ast.LtE : "<=",
     ast.Gt : ">",
     ast.GtE : ">=",
+    ast.Pow : "**",
     ast.Is : "is",
     ast.IsNot : "is not",
     ast.In : "in",

--- a/testing/code/test_assertion.py
+++ b/testing/code/test_assertion.py
@@ -146,6 +146,13 @@ def test_multiple_statements_per_line():
         e = exvalue()
         assert "assert 1 == 2" in e.msg
 
+def test_power():
+    try:
+        assert 2**3 == 7
+    except AssertionError:
+        e = exvalue()
+        assert "assert 8 == 7" in e.msg
+
 
 class TestView:
 

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -34,6 +34,7 @@ New features
 Bug fixes / Maintenance
 ++++++++++++++++++++++++++
 
+- fix assertion interpretation with the ** operator
 - 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



More information about the pytest-commit mailing list