1212from django .template .exceptions import TemplateSyntaxError
1313from django .test import override_settings
1414
15+ from django_bird .templatetags .tags .bird import END_TAG
16+ from django_bird .templatetags .tags .bird import TAG
1517from django_bird .templatetags .tags .bird import BirdNode
1618from django_bird .templatetags .tags .bird import do_bird
1719
1820
1921class TestTemplateTag :
2022 @pytest .mark .parametrize (
21- "name_arg ,expected" ,
23+ "name ,expected" ,
2224 [
2325 ("button" , "button" ),
2426 ("'button'" , "button" ),
2527 ('"button"' , "button" ),
2628 ("button.label" , "button.label" ),
2729 ],
2830 )
29- def test_node_name (self , name_arg , expected ):
30- token = Token (TokenType .BLOCK , f"bird { name_arg } " )
31+ def test_node_name (self , name , expected ):
32+ token = Token (TokenType .BLOCK , f"{ TAG } { name } " )
3133 parser = Parser (
32- [Token (TokenType .BLOCK , "endbird" )],
34+ [Token (TokenType .BLOCK , END_TAG )],
3335 )
3436 node = do_bird (parser , token )
3537 assert node .name == expected
3638
3739 def test_missing_argument (self ):
38- token = Token (TokenType .BLOCK , "bird" )
40+ token = Token (TokenType .BLOCK , TAG )
3941 parser = Parser (
40- [Token (TokenType .BLOCK , "endbird" )],
42+ [Token (TokenType .BLOCK , END_TAG )],
4143 )
4244 with pytest .raises (TemplateSyntaxError ):
4345 do_bird (parser , token )
@@ -51,9 +53,9 @@ def test_missing_argument(self):
5153 ],
5254 )
5355 def test_node_attrs (self , attrs , expected_attrs ):
54- token = Token (TokenType .BLOCK , f"bird button { attrs } " )
56+ token = Token (TokenType .BLOCK , f"{ TAG } button { attrs } " )
5557 parser = Parser (
56- [Token (TokenType .BLOCK , "endbird" )],
58+ [Token (TokenType .BLOCK , END_TAG )],
5759 )
5860 node = do_bird (parser , token )
5961 assert node .attrs == expected_attrs
0 commit comments