MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / testUniqueIds

Method testUniqueIds

tests/test_syntax/extensions/test_toc.py:205–258  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

203 )
204
205 def testUniqueIds(self):
206 self.assertMarkdownRenders(
207 self.dedent(
208 '''
209 #Header
210 #Header
211 #Header
212 '''
213 ),
214 self.dedent(
215 '''
216 <h1 id="header">Header</h1>
217 <h1 id="header_1">Header</h1>
218 <h1 id="header_2">Header</h1>
219 ''&#x27;
220 ),
221 expected_attrs={
222 'toc': (
223 '<div class="toc">\n'
224 '<ul>\n' # noqa
225 '<li><a href="#header">Header</a></li>\n' # noqa
226 '<li><a href="#header_1">Header</a></li>\n' # noqa
227 '<li><a href="#header_2">Header</a></li>\n' # noqa
228 '</ul>\n' # noqa
229 '</div>\n'
230 ),
231 'toc_tokens': [
232 {
233 'level': 1,
234 'id': 'header',
235 'name': 'Header',
236 'html': 'Header',
237 'data-toc-label': '',
238 'children': []
239 },
240 {
241 'level': 1,
242 'id': 'header_1',
243 'name': 'Header',
244 'html': 'Header',
245 'data-toc-label': '',
246 'children': []
247 },
248 {
249 'level': 1,
250 'id': 'header_2',
251 'name': 'Header',
252 'html': 'Header',
253 'data-toc-label': '',
254 'children': []
255 },
256 ]
257 }
258 )
259
260 def testHtmlEntitiesInTOC(self):
261 self.assertMarkdownRenders(

Callers

nothing calls this directly

Calls 2

assertMarkdownRendersMethod · 0.80
dedentMethod · 0.80

Tested by

no test coverage detected