MCPcopy
hub / github.com/pex-tool/pex / test_to_bytes

Function test_to_bytes

tests/test_compatibility.py:11–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9
10
11def test_to_bytes():
12 # type: () -> None
13 assert isinstance(to_bytes(""), bytes)
14 assert isinstance(to_bytes("abc"), bytes)
15 assert isinstance(to_bytes(b"abc"), bytes)
16 assert isinstance(to_bytes(u"abc"), bytes)
17 assert isinstance(to_bytes(b"abc".decode("latin-1"), encoding=u"utf-8"), bytes)
18
19 for bad_value in (123, None):
20 with pytest.raises(ValueError):
21 to_bytes(bad_value) # type: ignore[type-var]
22
23
24def test_to_unicode():

Callers

nothing calls this directly

Calls 2

to_bytesFunction · 0.90
decodeMethod · 0.80

Tested by

no test coverage detected