[py-svn] r12344 - py/dist/py/magic/testing

hpk at codespeak.net hpk at codespeak.net
Mon May 16 09:47:34 CEST 2005


Author: hpk
Date: Mon May 16 09:47:33 2005
New Revision: 12344

Modified:
   py/dist/py/magic/testing/test_assertion.py
Log:
added Ian's tests (one of which passes IMO, though)


Modified: py/dist/py/magic/testing/test_assertion.py
==============================================================================
--- py/dist/py/magic/testing/test_assertion.py	(original)
+++ py/dist/py/magic/testing/test_assertion.py	Mon May 16 09:47:33 2005
@@ -66,3 +66,24 @@
         assert 0 == 1, A()
     except AssertionError, e: 
         assert e.msg == "hello"
+
+
+# These tests should both fail, but should fail nicely...
+class WeirdRepr:
+    def __repr__(self):
+        return '<WeirdRepr\nsecond line>'
+            
+def bug_test_assert_repr():
+    v = WeirdRepr()
+    try: 
+        assert v == 1
+    except AssertionError, e: 
+        assert e.msg.find('WeirdRepr') != -1
+        assert e.msg.find('second line') != -1
+        assert 0
+        
+def test_assert_non_string():
+    try: 
+        assert 0, ['list']
+    except AssertionError, e: 
+        assert e.msg.find("list") != -1 



More information about the pytest-commit mailing list