@@ -31,12 +31,22 @@ def test_parser_reparse():
31
31
32
32
33
33
@pytest .mark .parametrize ("expected,data,kwargs" , [
34
- ("utf-16le" ,b"\xFF \xFE " , {"override_encoding" :"utf-8 " }),
35
- ("utf-16be" ,b"\xFE \xFF " , {"override_encoding" :"utf-8 " }),
34
+ ("utf-16le" ,b"\xFF \xFE " , {"override_encoding" :"iso-8859-2 " }),
35
+ ("utf-16be" ,b"\xFE \xFF " , {"override_encoding" :"iso-8859-2 " }),
36
36
("utf-8" ,b"\xEF \xBB \xBF " , {"override_encoding" :"iso-8859-2" }),
37
+ ("iso-8859-2" ,b"" , {"override_encoding" :"iso-8859-2" ,"transport_encoding" :"iso-8859-3" }),
38
+ ("iso-8859-2" ,b"<meta charset=iso-8859-3>" , {"transport_encoding" :"iso-8859-2" }),
39
+ ("iso-8859-2" ,b"<meta charset=iso-8859-2>" , {"same_origin_parent_encoding" :"iso-8859-3" }),
40
+ ("iso-8859-2" ,b"" , {"same_origin_parent_encoding" :"iso-8859-2" ,"likely_encoding" :"iso-8859-3" }),
41
+ ("iso-8859-2" ,b"" , {"same_origin_parent_encoding" :"utf-16" ,"likely_encoding" :"iso-8859-2" }),
42
+ ("iso-8859-2" ,b"" , {"same_origin_parent_encoding" :"utf-16be" ,"likely_encoding" :"iso-8859-2" }),
43
+ ("iso-8859-2" ,b"" , {"same_origin_parent_encoding" :"utf-16le" ,"likely_encoding" :"iso-8859-2" }),
44
+ ("iso-8859-2" ,b"" , {"likely_encoding" :"iso-8859-2" ,"default_encoding" :"iso-8859-3" }),
45
+ ("iso-8859-2" ,b"" , {"default_encoding" :"iso-8859-2" }),
46
+ ("windows-1252" ,b"" , {}),
37
47
])
38
48
def test_parser_args (expected ,data ,kwargs ):
39
- stream = inputstream .HTMLBinaryInputStream (data ,useChardet = False )
49
+ stream = inputstream .HTMLBinaryInputStream (data ,useChardet = False , ** kwargs )
40
50
assert expected == stream .charEncoding [0 ].name
41
51
p = HTMLParser ()
42
52
p .parse (data ,useChardet = False ,** kwargs )