()
| 4 | |
| 5 | |
| 6 | def 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 | |
| 36 | def test_serialization(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…