コード例 #1
0
ファイル: test_debug.py プロジェクト: sxauwj/werkzeug
    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)
コード例 #2
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)
コード例 #3
0
ファイル: test_debug.py プロジェクト: qsnake/werkzeug
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)
コード例 #4
0
ファイル: test_debug.py プロジェクト: Khan/frankenserver
    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)
コード例 #5
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)