MCPcopy Index your code
hub / github.com/python/mypy / test_encode_str_values

Method test_encode_str_values

mypyc/test/test_literals.py:24–33  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

22 assert format_str_literal("x" * 131) == b"\x81\x03" + b"x" * 131
23
24 def test_encode_str_values(self) -> None:
25 assert _encode_str_values({}) == [b""]
26 assert _encode_str_values({"foo": 0}) == [b"\x01\x03foo", b""]
27 assert _encode_str_values({"foo": 0, "b": 1}) == [b"\x02\x03foo\x01b", b""]
28 assert _encode_str_values({"foo": 0, "x" * 70: 1}) == [
29 b"\x01\x03foo",
30 bytes([1, 70]) + b"x" * 70,
31 b"",
32 ]
33 assert _encode_str_values({"y" * 100: 0}) == [bytes([1, 100]) + b"y" * 100, b""]
34
35 def test_encode_bytes_values(self) -> None:
36 assert _encode_bytes_values({}) == [b""]

Callers

nothing calls this directly

Calls 2

_encode_str_valuesFunction · 0.90
bytesClass · 0.85

Tested by

no test coverage detected