def test_invalid_codepoints_surrogates(inp, num): inp = eval(inp) # pylint:disable=eval-used fp = StringIO(inp) if ord(max(fp.read())) > 0xFFFF: pytest.skip("StringIO altered string") fp.seek(0) stream = HTMLUnicodeInputStream(fp) for _i in range(len(inp)): stream.char() assert len(stream.errors) == num
def test_invalid_codepoints(inp, num): stream = HTMLUnicodeInputStream(StringIO(inp)) for _i in range(len(inp)): stream.char() assert len(stream.errors) == num