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

Function test_nulls

python/pyarrow/tests/test_scalars.py:153–176  ·  view source on GitHub ↗
(pickle_module)

Source from the content-addressed store, hash-verified

151
152
153def test_nulls(pickle_module):
154 null = pa.scalar(None)
155 assert null is pa.NA
156 assert null.as_py() is None
157 assert null != "something"
158 assert (null == pa.scalar(None)) is True
159 assert (null == 0) is False
160 assert pa.NA == pa.NA
161 assert pa.NA not in [5]
162
163 arr = pa.array([None, None])
164 for v in arr:
165 assert v is pa.NA
166 assert v.as_py() is None
167
168 # test pickle roundtrip
169 restored = pickle_module.loads(pickle_module.dumps(null))
170 assert restored.equals(null)
171
172 # test that scalars are weak-referenceable
173 wr = weakref.ref(null)
174 assert wr() is not None
175 del null
176 assert wr() is not None # singleton
177
178
179def test_hashing():

Callers

nothing calls this directly

Calls 6

as_pyMethod · 0.80
loadsMethod · 0.80
dumpsMethod · 0.80
equalsMethod · 0.80
scalarMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected