sources for test_htmlhandlers.py [rev. 38799]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import py
from py.__.apigen.rest.htmlhandlers import PageHandler
def test_breadcrumb():
    h = PageHandler()
    for fname, expected in [
            ('module_py', '<a href="module_py.html">py</a>'),
            ('module_py.test',
                '<a href="module_py.test.html">py.test</a>'),
            ('class_py.test',
                ('<a href="module_py.html">py</a>.'
                 '<a href="class_py.test.html">test</a>')),
            ('class_py.test.foo',
                ('<a href="module_py.test.html">py.test</a>.'
                 '<a href="class_py.test.foo.html">foo</a>')),
            ('class_py.test.foo.bar',
                ('<a href="module_py.test.foo.html">py.test.foo</a>.'
                 '<a href="class_py.test.foo.bar.html">bar</a>')),
            ('function_foo', '<a href="function_foo.html">foo</a>'),
            ('function_foo.bar',
                ('<a href="module_foo.html">foo</a>.'
                 '<a href="function_foo.bar.html">bar</a>')),
            ('function_foo.bar.baz',
                ('<a href="module_foo.bar.html">foo.bar</a>.'
                 '<a href="function_foo.bar.baz.html">baz</a>')),
            ('method_foo.bar',
                ('<a href="class_foo.html">foo</a>.'
                 '<a href="method_foo.bar.html">bar</a>')),
            ('method_foo.bar.baz',
                ('<a href="module_foo.html">foo</a>.'
                 '<a href="class_foo.bar.html">bar</a>.'
                 '<a href="method_foo.bar.baz.html">baz</a>')),
            ('method_foo.bar.baz.qux',
                ('<a href="module_foo.bar.html">foo.bar</a>.'
                 '<a href="class_foo.bar.baz.html">baz</a>.'
                 '<a href="method_foo.bar.baz.qux.html">qux</a>')),
            ]:
        html = ''.join([unicode(el) for el in h.breadcrumb(fname)])
        print fname
        print html
        assert html == expected