MCPcopy
hub / github.com/rspeer/python-ftfy / test_guess_bytes

Function test_guess_bytes

tests/test_bytes.py:18–27  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

16
17@pytest.mark.parametrize("string", TEST_STRINGS)
18def test_guess_bytes(string):
19 for encoding in TEST_ENCODINGS:
20 result_str, result_encoding = guess_bytes(string.encode(encoding))
21 assert result_str == string
22 assert result_encoding == encoding
23
24 if "\n" in string:
25 old_mac_bytes = string.replace("\n", "\r").encode("macroman")
26 result_str, result_encoding = guess_bytes(old_mac_bytes)
27 assert result_str == string.replace("\n", "\r")
28
29
30def test_guess_bytes_null():

Callers

nothing calls this directly

Calls 2

guess_bytesFunction · 0.90
encodeMethod · 0.45

Tested by

no test coverage detected