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

Method test_simple_nulls

python/pyarrow/tests/test_csv.py:1017–1038  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1015 }
1016
1017 def test_simple_nulls(self):
1018 # Infer various kinds of data, with nulls
1019 rows = (b"a,b,c,d,e,f\n"
1020 b"1,2,,,3,N/A\n"
1021 b"nan,-5,foo,,nan,TRUE\n"
1022 b"4.5,#N/A,nan,,\xff,false\n")
1023 table = self.read_bytes(rows)
1024 schema = pa.schema([('a', pa.float64()),
1025 ('b', pa.int64()),
1026 ('c', pa.string()),
1027 ('d', pa.null()),
1028 ('e', pa.binary()),
1029 ('f', pa.bool_())])
1030 assert table.schema == schema
1031 assert table.to_pydict() == {
1032 'a': [1.0, None, 4.5],
1033 'b': [2, -5, None],
1034 'c': ["", "foo", "nan"],
1035 'd': [None, None, None],
1036 'e': [b"3", b"nan", b"\xff"],
1037 'f': [None, True, False],
1038 }
1039
1040 def test_decimal_point(self):
1041 # Infer floats with a custom decimal point

Callers

nothing calls this directly

Calls 3

read_bytesMethod · 0.95
schemaMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected