Exemplo n.º 1
0
def test_object_dumping():
    """Test debug object dumping to HTML"""
    class Foo(object):
        x = 42
        y = 23
        def __init__(self):
            self.z = 15

    drg = DebugReprGenerator()
    out = drg.dump_object(Foo())
    print out
    assert re.search('Details for test_debug.Foo object at', out)
    assert re.search('<th>x.*<span class="number">42</span>(?s)', out)
    assert re.search('<th>y.*<span class="number">23</span>(?s)', out)
    assert re.search('<th>z.*<span class="number">15</span>(?s)', out)

    out = drg.dump_object({'x': 42, 'y': 23})
    assert re.search('Contents of', out)
    assert re.search('<th>x.*<span class="number">42</span>(?s)', out)
    assert re.search('<th>y.*<span class="number">23</span>(?s)', out)

    out = drg.dump_object({'x': 42, 'y': 23, 23: 11})
    assert not re.search('Contents of', out)

    out = drg.dump_locals({'x': 42, 'y': 23})
    assert re.search('Local variables in frame', out)
    assert re.search('<th>x.*<span class="number">42</span>(?s)', out)
    assert re.search('<th>y.*<span class="number">23</span>(?s)', out)
Exemplo n.º 2
0
    def test_object_dumping(self):
        drg = DebugReprGenerator()
        out = drg.dump_object(Foo())
        assert re.search('Details for tests.test_debug.Foo object at', out)
        assert re.search('<th>x.*<span class="number">42</span>(?s)', out)
        assert re.search('<th>y.*<span class="number">23</span>(?s)', out)
        assert re.search('<th>z.*<span class="number">15</span>(?s)', out)

        out = drg.dump_object({'x': 42, 'y': 23})
        assert re.search('Contents of', out)
        assert re.search('<th>x.*<span class="number">42</span>(?s)', out)
        assert re.search('<th>y.*<span class="number">23</span>(?s)', out)

        out = drg.dump_object({'x': 42, 'y': 23, 23: 11})
        assert not re.search('Contents of', out)

        out = drg.dump_locals({'x': 42, 'y': 23})
        assert re.search('Local variables in frame', out)
        assert re.search('<th>x.*<span class="number">42</span>(?s)', out)
        assert re.search('<th>y.*<span class="number">23</span>(?s)', out)
Exemplo n.º 3
0
    def test_object_dumping(self):
        drg = DebugReprGenerator()
        out = drg.dump_object(Foo())
        assert re.search("Details for werkzeug.testsuite.debug.Foo object at", out)
        assert re.search('<th>x.*<span class="number">42</span>(?s)', out)
        assert re.search('<th>y.*<span class="number">23</span>(?s)', out)
        assert re.search('<th>z.*<span class="number">15</span>(?s)', out)

        out = drg.dump_object({"x": 42, "y": 23})
        assert re.search("Contents of", out)
        assert re.search('<th>x.*<span class="number">42</span>(?s)', out)
        assert re.search('<th>y.*<span class="number">23</span>(?s)', out)

        out = drg.dump_object({"x": 42, "y": 23, 23: 11})
        assert not re.search("Contents of", out)

        out = drg.dump_locals({"x": 42, "y": 23})
        assert re.search("Local variables in frame", out)
        assert re.search('<th>x.*<span class="number">42</span>(?s)', out)
        assert re.search('<th>y.*<span class="number">23</span>(?s)', out)
Exemplo n.º 4
0
    def test_object_dumping(self):
        drg = DebugReprGenerator()
        out = drg.dump_object(Foo())
        assert re.search('Details for tests.test_debug.Foo object at', out)
        assert re.search('<th>x.*<span class="number">42</span>',
                         out,
                         flags=re.DOTALL)
        assert re.search('<th>y.*<span class="number">23</span>',
                         out,
                         flags=re.DOTALL)
        assert re.search('<th>z.*<span class="number">15</span>',
                         out,
                         flags=re.DOTALL)

        out = drg.dump_object({'x': 42, 'y': 23})
        assert re.search('Contents of', out)
        assert re.search('<th>x.*<span class="number">42</span>',
                         out,
                         flags=re.DOTALL)
        assert re.search('<th>y.*<span class="number">23</span>',
                         out,
                         flags=re.DOTALL)

        out = drg.dump_object({'x': 42, 'y': 23, 23: 11})
        assert not re.search('Contents of', out)

        out = drg.dump_locals({'x': 42, 'y': 23})
        assert re.search('Local variables in frame', out)
        assert re.search('<th>x.*<span class="number">42</span>',
                         out,
                         flags=re.DOTALL)
        assert re.search('<th>y.*<span class="number">23</span>',
                         out,
                         flags=re.DOTALL)
Exemplo n.º 5
0
def test_object_dumping():
    """Test debug object dumping to HTML"""
    class Foo(object):
        x = 42
        y = 23
        def __init__(self):
            self.z = 15

    drg = DebugReprGenerator()
    out = drg.dump_object(Foo())
    assert re.search('Details for test_debug.Foo object at', out)
    assert re.search('<th>x</th>.*<span class="number">42</span>(?s)', out)
    assert re.search('<th>y</th>.*<span class="number">23</span>(?s)', out)
    assert re.search('<th>z</th>.*<span class="number">15</span>(?s)', out)

    out = drg.dump_object({'x': 42, 'y': 23})
    assert re.search('Contents of', out)
    assert re.search('<th>x</th>.*<span class="number">42</span>(?s)', out)
    assert re.search('<th>y</th>.*<span class="number">23</span>(?s)', out)

    out = drg.dump_object({'x': 42, 'y': 23, 23: 11})
    assert not re.search('Contents of', out)

    out = drg.dump_locals({'x': 42, 'y': 23})
    assert re.search('Local variables in frame', out)
    assert re.search('<th>x</th>.*<span class="number">42</span>(?s)', out)
    assert re.search('<th>y</th>.*<span class="number">23</span>(?s)', out)