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

Method testUniqueIds

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

assertMarkdownRendersMethod · 0.80
dedentMethod · 0.80

Tested by

no test coverage detected