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

Method test_struct_str

mypyc/test/test_struct.py:50–62  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 assert r7.size == 12
49
50 def test_struct_str(self) -> None:
51 r = RStruct("Foo", ["a", "b"], [bool_rprimitive, object_rprimitive])
52 assert str(r) == "Foo{a:bool, b:object}"
53 assert (
54 repr(r) == "<RStruct Foo{a:<RPrimitive builtins.bool>, "
55 "b:<RPrimitive builtins.object>}>"
56 )
57 r1 = RStruct("Bar", ["c"], [int32_rprimitive])
58 assert str(r1) == "Bar{c:i32}"
59 assert repr(r1) == "<RStruct Bar{c:<RPrimitive i32>}>"
60 r2 = RStruct("Baz", [], [])
61 assert str(r2) == "Baz{}"
62 assert repr(r2) == "<RStruct Baz{}>"
63
64 def test_runtime_subtype(self) -> None:
65 # right type to check with

Callers

nothing calls this directly

Calls 3

RStructClass · 0.90
strClass · 0.85
reprFunction · 0.85

Tested by

no test coverage detected