MCPcopy Create free account
hub / github.com/apache/fory / test_infer_field

Function test_infer_field

python/pyfory/format/tests/test_infer.py:79–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77
78
79def test_infer_field():
80 assert _infer_field("", int).type.id == TypeId.INT64
81 assert _infer_field("", float).type.id == TypeId.FLOAT64
82 assert _infer_field("", str).type.id == TypeId.STRING
83 assert _infer_field("", bytes).type.id == TypeId.BINARY
84 assert _infer_field("", List[str]).type.id == TypeId.LIST
85 assert _infer_field("", Tuple[str, ...]).type.id == TypeId.LIST
86 assert _infer_field("", Tuple[int, int]).type.id == TypeId.LIST
87 assert _infer_field("", Dict[str, str]).type.id == TypeId.MAP
88 assert _infer_field("", List[Dict[str, str]]).type.id == TypeId.LIST
89 assert _infer_field("", List[Tuple[int, ...]]).type.id == TypeId.LIST
90
91 with pytest.raises(TypeError):
92 _infer_field("", Tuple[str, int])
93
94 # Custom class is treated as a struct
95 class X:
96 pass
97
98 result = _infer_field("", X)
99 assert result.type.id == TypeId.STRUCT
100
101
102def test_pyfory_scalar_markers_infer_row_value_types():

Callers

nothing calls this directly

Calls 1

_infer_fieldFunction · 0.85

Tested by

no test coverage detected