~ubuntu-branches/ubuntu/karmic/pypy/karmic

« back to all changes in this revision

Viewing changes to py/code/testing/test_frame.py

  • Committer: Bazaar Package Importer
  • Author(s): Alexandre Fayolle
  • Date: 2007-04-13 09:33:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070413093309-yoojh4jcoocu2krz
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import sys
 
2
import py
 
3
 
 
4
def test_frame_getsourcelineno_myself():
 
5
    def func():
 
6
        return sys._getframe(0)
 
7
    f = func()
 
8
    f = py.code.Frame(f)
 
9
    source, lineno = f.code.fullsource, f.lineno
 
10
    assert source[lineno].startswith("        return sys._getframe(0)")
 
11
 
 
12
def test_code_from_func(): 
 
13
    co = py.code.Code(test_frame_getsourcelineno_myself) 
 
14
    assert co.firstlineno
 
15
    assert co.path