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

Method test_simple_nulls

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

Source from the content-addressed store, hash-verified

1031 }
1032
1033 def test_simple_nulls(self):
1034 # Infer various kinds of data, with nulls
1035 rows = (b"a,b,c,d,e,f\n"
1036 b"1,2,,,3,N/A\n"
1037 b"nan,-5,foo,,nan,TRUE\n"
1038 b"4.5,#N/A,nan,,\xff,false\n")
1039 table = self.read_bytes(rows)
1040 schema = pa.schema([('a', pa.float64()),
1041 ('b', pa.int64()),
1042 ('c', pa.string()),
1043 ('d', pa.null()),
1044 ('e', pa.binary()),
1045 ('f', pa.bool_())])
1046 assert table.schema == schema
1047 assert table.to_pydict() == {
1048 'a': [1.0, None, 4.5],
1049 'b': [2, -5, None],
1050 'c': ["", "foo", "nan"],
1051 'd': [None, None, None],
1052 'e': [b"3", b"nan", b"\xff"],
1053 'f': [None, True, False],
1054 }
1055
1056 def test_decimal_point(self):
1057 # 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