@@ -686,27 +686,27 @@ def test_broken_condcoms(self):
686686 ]
687687 self ._run_check (html , expected )
688688
689- def test_cdata_declarations ( self ):
690- # More tests should be added. See also "8.2.4.42. Markup
691- # declaration open state", "8.2.4.69. CDATA section state" ,
692- # and issue 32876
693- html = ( '<![CDATA[just some plain text]]>' )
694- expected = [( 'unknown decl' , 'CDATA[just some plain text' )]
695- self . _run_check ( html , expected )
696-
697- def test_cdata_declarations_multiline ( self ):
698- html = ( '<code><![CDATA['
699- ' if (a < b && a > b) {'
700- ' printf("[<marquee>How?</marquee>]"); '
701- ' } '
702- ']]></code>' )
703- expected = [
704- ( 'starttag' , 'code' , []),
705- ( 'unknown decl' ,
706- 'CDATA[ if (a < b && a > b) { '
707- 'printf("[<marquee>How?</marquee>]"); }' ),
708- ( 'endtag' , 'code' )
709- ]
689+ @ support . subTests ( 'content' , [
690+ 'just some plain text' ,
691+ '<!-- not a comment -->' ,
692+ '¬-an-entity-ref;' ,
693+ "<not a='start tag'>" ,
694+ '' ,
695+ '[[I have many brackets]]' ,
696+ 'I have a > in the middle' ,
697+ 'I have a ]] in the middle' ,
698+ '] ]>' ,
699+ ']] >' ,
700+ ( ' \n '
701+ ' if (a < b && a > b) { \n '
702+ ' printf("[<marquee>How?</marquee>]"); \n '
703+ ' } \n ' ),
704+ ])
705+ def test_cdata_section ( self , content ):
706+ # See "13.2.5.42 Markup declaration open state",
707+ # "13.2.5.69 CDATA section state", and issue bpo-32876.
708+ html = f'<![CDATA[ { content } ]]>'
709+ expected = [( 'unknown decl' , 'CDATA[' + content ) ]
710710 self ._run_check (html , expected )
711711
712712 def test_convert_charrefs_dropped_text (self ):
0 commit comments