MCPcopy Create free account
hub / github.com/apache/arrow / test_simple_nulls

Method test_simple_nulls

python/pyarrow/tests/test_json.py:212–230  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

210 }
211
212 def test_simple_nulls(self):
213 # Infer various kinds of data, with nulls
214 rows = (b'{"a": 1, "b": 2, "c": null, "d": null, "e": null}\n'
215 b'{"a": null, "b": -5, "c": "foo", "d": null, "e": true}\n'
216 b'{"a": 4.5, "b": null, "c": "nan", "d": null,"e": false}\n')
217 table = self.read_bytes(rows)
218 schema = pa.schema([('a', pa.float64()),
219 ('b', pa.int64()),
220 ('c', pa.string()),
221 ('d', pa.null()),
222 ('e', pa.bool_())])
223 assert table.schema == schema
224 assert table.to_pydict() == {
225 'a': [1.0, None, 4.5],
226 'b': [2, -5, None],
227 'c': [None, "foo", "nan"],
228 'd': [None, None, None],
229 'e': [None, True, False],
230 }
231
232 def test_empty_lists(self):
233 # ARROW-10955: Infer list(null)

Callers

nothing calls this directly

Calls 3

read_bytesMethod · 0.95
schemaMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected