[svn r60139] some minimal testing for Code.source/fullsource

--HG--
branch : trunk
This commit is contained in:
pedronis 2008-11-25 18:28:40 +01:00
parent d491d68d51
commit 3ec0a76adb
1 changed files with 16 additions and 0 deletions

View File

@ -83,3 +83,19 @@ def test_code_with_class():
class A:
pass
py.test.raises(TypeError, "py.code.Code(A)")
if True:
def x():
pass
def test_code_fullsource():
code = py.code.Code(x)
full = code.fullsource
assert 'test_code_fullsource()' in str(full)
def test_code_source():
code = py.code.Code(x)
src = code.source()
expected = """def x():
pass"""
assert str(src) == expected