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

Method test_simple_nulls

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

Source from the content-addressed store, hash-verified

204 }
205
206 def test_simple_nulls(self):
207 # Infer various kinds of data, with nulls
208 rows = (b'{"a": 1, "b": 2, "c": null, "d": null, "e": null}\n'
209 b'{"a": null, "b": -5, "c": "foo", "d": null, "e": true}\n'
210 b'{"a": 4.5, "b": null, "c": "nan", "d": null,"e": false}\n')
211 table = self.read_bytes(rows)
212 schema = pa.schema([('a', pa.float64()),
213 ('b', pa.int64()),
214 ('c', pa.string()),
215 ('d', pa.null()),
216 ('e', pa.bool_())])
217 assert table.schema == schema
218 assert table.to_pydict() == {
219 'a': [1.0, None, 4.5],
220 'b': [2, -5, None],
221 'c': [None, "foo", "nan"],
222 'd': [None, None, None],
223 'e': [None, True, False],
224 }
225
226 def test_empty_lists(self):
227 # 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