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

Method test_simple_nulls

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

Source from the content-addressed store, hash-verified

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