Coverage for tdom / tnodes_test.py: 100%
20 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-17 23:32 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-17 23:32 +0000
1import pytest
3from .template_utils import TemplateRef
4from .tnodes import TComment, TNode, TText
7def test_tnode_abstract_methods() -> None:
8 node = TNode()
9 with pytest.raises(NotImplementedError):
10 _ = node.__html__()
11 with pytest.raises(NotImplementedError):
12 _ = node.__str__()
15def test_ttext_literal() -> None:
16 text = "Hello, World!"
17 ttext = TText.literal(text)
18 assert ttext.ref == TemplateRef.literal(text)
21def test_ttext_empty() -> None:
22 ttext = TText.empty()
23 assert ttext.ref == TemplateRef.empty()
26def test_tcomment_literal() -> None:
27 comment = "This is a comment"
28 tcomment = TComment.literal(comment)
29 assert tcomment.ref == TemplateRef.literal(comment)