def test_tag_node5(self): 'Nodes for short tags record' tree = self.get_mint_tree('@tag @tag2') self.assertEqual( tree, mint.MintTemplate(body=[ mint.TagNode( 'tag', attrs=[], body=[ mint.TagNode( 'tag2', attrs=[], body=[], lineno=1, col_offset=6) ], lineno=1, col_offset=1) ]))
def test_tag_node4(self): 'Tag node with child tag' tree = self.get_mint_tree('@tag\n' ' @tag2') self.assertEqual( tree, mint.MintTemplate(body=[ mint.TagNode( 'tag', attrs=[], body=[ mint.TagNode( 'tag2', attrs=[], body=[], lineno=2, col_offset=5) ], lineno=1, col_offset=1) ]))
def test_tag_node(self): 'Tag node' tree = self.get_mint_tree('@tag') self.assertEqual( tree, mint.MintTemplate( body=[mint.TagNode('tag', lineno=1, col_offset=1)]))
def test_tag_node6(self): 'Nodes for short tags record with text' tree = self.get_mint_tree('@tag @tag2 text value') self.assertEqual( tree, mint.MintTemplate(body=[ mint.TagNode('tag', attrs=[], body=[ mint.TagNode('tag2', attrs=[], body=[ mint.TextNode('text value\n', lineno=1, col_offset=12) ], lineno=1, col_offset=6) ], lineno=1, col_offset=1) ]))
def test_tag_node2(self): 'Tag node with attrs' tree = self.get_mint_tree('@tag.attr(value)') self.assertEqual( tree, mint.MintTemplate(body=[ mint.TagNode('tag', attrs=[ mint.TagAttrNode( 'attr', value=[ mint.TextNode( 'value', lineno=1, col_offset=11) ], lineno=1, col_offset=6) ], lineno=1, col_offset=1) ]))
def test_tag_attr(self): 'Tag attribute node with expression' tree = self.get_mint_tree('@tag.attr({{ expression }})') self.assertEqual( tree, mint.MintTemplate(body=[ mint.TagNode('tag', attrs=[ mint.TagAttrNode('attr', value=[ mint.ExpressionNode( 'expression', lineno=1, col_offset=11) ], lineno=1, col_offset=6) ], lineno=1, col_offset=1) ]))