コード例 #1
0
ファイル: test_rest.py プロジェクト: TheDunn/flex-pypy
def test_viewvc_link():
    vcview = ViewVC("http://codespeak.net/viewvc/")
    fname = cut_pyc(__file__)
    title, link = vcview.getlink(fname, 0, "")
    assert title == '%s:%s' % (fname, 0)
    assert link == ('http://codespeak.net/viewvc/py/apigen/rest/'
                        'testing/test_rest.py?view=markup')
コード例 #2
0
ファイル: test_docgen.py プロジェクト: paskma/py
def test_basic():
    descs = {"fun": fun}
    ds = DocStorage().from_dict(descs)
    t = Tracer(ds)
    t.start_tracing()
    fun(1, ("g", 3), 8)
    fun(2.0, ("a", 1.0), "a")
    t.end_tracing()
    desc = ds.descs["fun"]
    inputcells = desc.inputcells
    assert len(inputcells) == 3
    assert isinstance(inputcells[0], model.SomeUnion)
    assert isinstance(inputcells[1], model.SomeTuple)
    assert isinstance(inputcells[2], model.SomeUnion)
    assert isinstance(desc.retval, model.SomeString)
    cs = sorted(desc.call_sites.keys())
    assert len(cs) == 2
    f_name = cut_pyc(__file__)
    assert len(cs[0]) == 1
    assert len(cs[1]) == 1
    assert cs[1][0].filename == f_name
    # lines are counted from 0
    num = test_basic.func_code.co_firstlineno
    assert cs[1][0].lineno == num + 4 or cs[1][0].lineno == num + 5
    assert cs[0][0].filename == f_name
    assert cs[0][0].lineno == num + 5 or cs[0][0].lineno == num + 4
    if 0:
        pds = PermaDocStorage(DocStorageAccessor(ds))
        assert pds.get_function_names() == ["fun"]
        sig = pds.get_function_signature("fun")
        assert sig[0][0][0] == "a"
        assert isinstance(sig[0][0][1], model.SomeUnion)
        assert len(pds.get_function_callpoints("fun")) == 2
コード例 #3
0
ファイル: test_rest.py プロジェクト: TheDunn/flex-pypy
def test_direct_link():
    fname = cut_pyc(__file__)
    title, link = DirectPaste().getlink(fname, 2, "")
    assert title == '%s:%s' % (fname, 2)
    assert link == ''