(self)
| 92 | self.assertEqual('test/module.md', parser.documentation_path('test.module')) |
| 93 | |
| 94 | def test_replace_references(self): |
| 95 | class HasOneMember(object): |
| 96 | |
| 97 | def foo(self): |
| 98 | pass |
| 99 | |
| 100 | string = ( |
| 101 | 'A @{tf.reference}, another @{tf.reference$with\nnewline}, a member ' |
| 102 | '@{tf.reference.foo}, and a @{tf.third$link `text` with `code` in ' |
| 103 | 'it}.') |
| 104 | duplicate_of = {'tf.third': 'tf.fourth'} |
| 105 | index = {'tf.reference': HasOneMember, |
| 106 | 'tf.reference.foo': HasOneMember.foo, |
| 107 | 'tf.third': HasOneMember, |
| 108 | 'tf.fourth': HasOneMember} |
| 109 | |
| 110 | visitor = DummyVisitor(index, duplicate_of) |
| 111 | |
| 112 | reference_resolver = parser.ReferenceResolver.from_visitor( |
| 113 | visitor=visitor, doc_index={}, py_module_names=['tf']) |
| 114 | |
| 115 | result = reference_resolver.replace_references(string, '../..') |
| 116 | self.assertEqual('A <a href="../../tf/reference.md">' |
| 117 | '<code>tf.reference</code></a>, ' |
| 118 | 'another <a href="../../tf/reference.md">' |
| 119 | 'with\nnewline</a>, ' |
| 120 | 'a member <a href="../../tf/reference.md#foo">' |
| 121 | '<code>tf.reference.foo</code></a>, ' |
| 122 | 'and a <a href="../../tf/fourth.md">link ' |
| 123 | '<code>text</code> with ' |
| 124 | '<code>code</code> in it</a>.', result) |
| 125 | |
| 126 | def test_doc_replace_references(self): |
| 127 | string = '@{$doc1} @{$doc1#abc} @{$doc1$link} @{$doc1#def$zelda} @{$do/c2}' |
nothing calls this directly
no test coverage detected