MCPcopy Create free account
hub / github.com/executablebooks/markdown-it-py / test_token

Function test_token

tests/test_api/test_token.py:6–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5
6def test_token():
7 token = Token("name", "tag", 0)
8 assert token.as_dict() == {
9 "type": "name",
10 "tag": "tag",
11 "nesting": 0,
12 "attrs": None,
13 "map": None,
14 "level": 0,
15 "children": None,
16 "content": "",
17 "markup": "",
18 "info": "",
19 "meta": {},
20 "block": False,
21 "hidden": False,
22 }
23 token.attrSet("a", "b")
24 assert token.attrGet("a") == "b"
25 token.attrJoin("a", "c")
26 assert token.attrGet("a") == "b c"
27 token.attrPush(("x", "y"))
28 assert token.attrGet("x") == "y"
29 with warnings.catch_warnings():
30 warnings.simplefilter("ignore")
31 assert token.attrIndex("a") == 0
32 assert token.attrIndex("x") == 1
33 assert token.attrIndex("j") == -1
34
35
36def test_serialization():

Callers

nothing calls this directly

Calls 7

as_dictMethod · 0.95
attrSetMethod · 0.95
attrGetMethod · 0.95
attrJoinMethod · 0.95
attrPushMethod · 0.95
attrIndexMethod · 0.95
TokenClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…