# HG changeset patch -- Bitbucket.org
# Project py
# URL http://bitbucket.org/hpk42/py/overview
# User holger krekel <hol...@merlinux.eu>
# Date 1290613692 -3600
# Node ID ceb0875f32dcd662c4ca8991b7bb6a4363bcb4ee
# Parent  beee8a9b2fe566759dd381b1e4ce5b83731eaa90
slightly refine assertion heuristic

--- a/testing/code/test_assertion.py
+++ b/testing/code/test_assertion.py
@@ -252,10 +252,9 @@ def test_assert_customizable_reprcompare
         s = str(e)
         assert "hello" in s
 
-def test_assert_long_source():
-    result = None
+def test_assert_long_source_1():
     try:
-        assert result == [
+        assert len == [
             (None, ['somet text', 'more text']),
         ]
     except AssertionError:
@@ -263,3 +262,14 @@ def test_assert_long_source():
         s = str(e)
         assert 're-run' not in s
         assert 'somet text' in s
+
+def test_assert_long_source_2():
+    try:
+        assert(len == [
+            (None, ['somet text', 'more text']),
+        ])
+    except AssertionError:
+        e = exvalue()
+        s = str(e)
+        assert 're-run' not in s
+        assert 'somet text' in s

--- a/py/_code/source.py
+++ b/py/_code/source.py
@@ -118,7 +118,7 @@ class Source(object):
         from codeop import compile_command
         for start in range(lineno, -1, -1):
             if assertion:
-                if "assert " not in self.lines[start]:
+                if "assert" not in self.lines[start]:
                     continue
                 
             trylines = self.lines[start:lineno+1]
_______________________________________________
py-svn mailing list
py-svn@codespeak.net
http://codespeak.net/mailman/listinfo/py-svn

Reply via email to