()
| 77 | |
| 78 | |
| 79 | def 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 | |
| 102 | def test_pyfory_scalar_markers_infer_row_value_types(): |
nothing calls this directly
no test coverage detected