Spaces Data

Minimal test - lines (81, 85)

path: .spaces[4].metrics.mi.mi_visual_studio
old: 78.39554672677042
new: 76.28155518800422

path: .spaces[4].metrics.mi.mi_sei
old: 152.77484308930326
new: 154.10739759318386

path: .spaces[4].metrics.mi.mi_original
old: 134.0563849027774
new: 130.4414593714872

path: .spaces[4].metrics.loc.cloc
old: 1.0
new: 2.0

path: .spaces[4].metrics.loc.sloc
old: 4.0
new: 5.0

Code

def g():
    #
    __tracebackhide__ = True
    f()
    #

Minimal test - lines (77, 80)

path: .spaces[3].metrics.mi.mi_sei
old: 168.48614000756413
new: 167.22660220636422

path: .spaces[3].metrics.mi.mi_original
old: 142.15938490684147
new: 137.49893533312263

path: .spaces[3].metrics.mi.mi_visual_studio
old: 83.13414322037512
new: 80.40873411293721

path: .spaces[3].metrics.loc.sloc
old: 3.0
new: 4.0

path: .spaces[3].metrics.loc.cloc
old: 1.0
new: 2.0

Code

def f():
    #
    raise ValueError
    #

Minimal test - lines (54, 74)

path: .spaces[2].metrics.loc.sloc
old: 18.0
new: 21.0

path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 3.0

path: .spaces[2].metrics.mi.mi_original
old: 91.64036187712064
new: 89.14312086391905

path: .spaces[2].metrics.mi.mi_sei
old: 57.11916278980597
new: 81.14888270424778

path: .spaces[2].metrics.mi.mi_visual_studio
old: 53.59085489890095
new: 52.13048003737956

Code

def test_excinfo_getstatement():
    def g():
        raise ValueError

    def f():
        g()
    try:
        f()
    except ValueError:
        excinfo = py.code.ExceptionInfo()
    linenumbers = [
        py.code.getrawcode(f).co_firstlineno-1+3,
        py.code.getrawcode(f).co_firstlineno-1+1,
        py.code.getrawcode(g).co_firstlineno-1+1,
    ]
    l = list(excinfo.traceback)
    foundlinenumbers = [x.lineno for x in l]
    assert foundlinenumbers == linenumbers
    #for x in info:
    #    print "%s:%d  %s" %(x.path.relto(root), x.lineno, x.statement)
    #xxx

Minimal test - lines (86, 89)

path: .spaces[5].metrics.mi.mi_original
old: 144.86478113187096
new: 140.20433155815212

path: .spaces[5].metrics.mi.mi_sei
old: 172.3892017250539
new: 171.12966392385397

path: .spaces[5].metrics.mi.mi_visual_studio
old: 84.71624627594792
new: 81.99083716851001

path: .spaces[5].metrics.loc.cloc
old: 1.0
new: 2.0

path: .spaces[5].metrics.loc.sloc
old: 3.0
new: 4.0

Code

def h():
    #
    g()
    #

Minimal test - lines (492, 521)

path: .spaces[17].spaces[8].metrics.loc.cloc
old: 2.0
new: 3.0

path: .spaces[17].spaces[8].metrics.loc.sloc
old: 29.0
new: 30.0

path: .spaces[17].spaces[8].metrics.mi.mi_sei
old: 60.33411901275782
new: 63.28320070826774

path: .spaces[17].spaces[8].metrics.mi.mi_visual_studio
old: 46.70895806991902
new: 46.38778547509678

path: .spaces[17].spaces[8].metrics.mi.mi_original
old: 79.87231829956153
new: 79.3231131624155

Code

    def test_repr_tracebackentry_lines(self, importasmod):
        mod = importasmod("""
            def func1():
                raise ValueError("hello\\nworld")
        """)
        excinfo = py.test.raises(ValueError, mod.func1)
        excinfo.traceback = excinfo.traceback.filter()
        p = FormattedExcinfo()
        reprtb = p.repr_traceback_entry(excinfo.traceback[-1])

        # test as intermittent entry
        lines = reprtb.lines
        assert lines[0] == '    def func1():'
        assert lines[1] == '>       raise ValueError("hello\\nworld")'

        # test as last entry
        p = FormattedExcinfo(showlocals=True)
        repr_entry = p.repr_traceback_entry(excinfo.traceback[-1], excinfo)
        lines = repr_entry.lines
        assert lines[0] == '    def func1():'
        assert lines[1] == '>       raise ValueError("hello\\nworld")'
        assert lines[2] == 'E       ValueError: hello'
        assert lines[3] == 'E       world'
        assert not lines[4:]

        loc = repr_entry.reprlocals is not None
        loc = repr_entry.reprfileloc
        assert loc.path == mod.__file__
        assert loc.lineno == 3
        #assert loc.message == "ValueError: hello"