11import re
22
3+ import pytest
4+
35from mako import compat
46from mako import exceptions
57from mako import parsetree
@@ -146,6 +148,10 @@ def test_noexpr_allowed(self):
146148 """
147149 assert_raises (exceptions .CompileException , Lexer (template ).parse )
148150
151+ def test_tag_many_quotes (self ):
152+ template = "<%0" + '"' * 3000
153+ assert_raises (exceptions .SyntaxException , Lexer (template ).parse )
154+
149155 def test_unmatched_tag (self ):
150156 template = """
151157 <%namespace name="bar">
@@ -432,9 +438,16 @@ def test_expr_in_attribute(self):
432438 ),
433439 )
434440
435- def test_pagetag (self ):
436- template = """
437- <%page cached="True", args="a, b"/>
441+ @pytest .mark .parametrize ("comma,numchars" , [("," , 48 ), ("" , 47 )])
442+ def test_pagetag (self , comma , numchars ):
443+ # note that the comma here looks like:
444+ # <%page cached="True", args="a, b"/>
445+ # that's what this test has looked like for decades, however, the
446+ # comma there is not actually the right syntax. When issue #366
447+ # was fixed, the reg was altered to accommodate for this comma to allow
448+ # backwards compat
449+ template = f"""
450+ <%page cached="True"{ comma } args="a, b"/>
438451
439452 some template
440453 """
@@ -453,7 +466,7 @@ def test_pagetag(self):
453466
454467 some template
455468 """ ,
456- (2 , 48 ),
469+ (2 , numchars ),
457470 ),
458471 ],
459472 ),
0 commit comments