Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_invalid_utf8():
with jsonlines.Reader([b'\xff\xff']) as reader:
with pytest.raises(jsonlines.InvalidLineError) as excinfo:
reader.read()
assert 'line is not valid utf-8' in str(excinfo.value)