[py-svn] r37242 - py/branch/config/py/test/testing

fijal at codespeak.net fijal at codespeak.net
Tue Jan 23 23:53:30 CET 2007


Author: fijal
Date: Tue Jan 23 23:53:28 2007
New Revision: 37242

Added:
   py/branch/config/py/test/testing/test_repr.py
Log:
Add a file for testing representation.py


Added: py/branch/config/py/test/testing/test_repr.py
==============================================================================
--- (empty file)
+++ py/branch/config/py/test/testing/test_repr.py	Tue Jan 23 23:53:28 2007
@@ -0,0 +1,22 @@
+
+import py
+from py.__.test.representation import Presenter
+from py.__.test.terminal.out import getout
+from StringIO import StringIO
+
+def test_repr_source():
+    source = py.code.Source("""
+    def f(x):
+        pass
+    """).strip()
+    config = py.test.config._reparse([])
+    s = StringIO()
+    out = getout(s)
+    p = Presenter(out, config)
+    p.repr_source(source, "|", 0)
+    lines = s.getvalue().split("\n")
+    assert len(lines) == 3
+    assert lines[0].startswith("|")
+    assert lines[0].find("def f(x)") != -1
+    assert lines[1].find("pass") != -1
+



More information about the pytest-commit mailing list