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

Function test_chunked_array_equals

python/pyarrow/tests/test_table.py:247–292  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

245
246
247def test_chunked_array_equals():
248 def eq(xarrs, yarrs):
249 if isinstance(xarrs, pa.ChunkedArray):
250 x = xarrs
251 else:
252 x = pa.chunked_array(xarrs)
253 if isinstance(yarrs, pa.ChunkedArray):
254 y = yarrs
255 else:
256 y = pa.chunked_array(yarrs)
257 assert x.equals(y)
258 assert y.equals(x)
259 assert x == y
260 assert x != str(y)
261
262 def ne(xarrs, yarrs):
263 if isinstance(xarrs, pa.ChunkedArray):
264 x = xarrs
265 else:
266 x = pa.chunked_array(xarrs)
267 if isinstance(yarrs, pa.ChunkedArray):
268 y = yarrs
269 else:
270 y = pa.chunked_array(yarrs)
271 assert not x.equals(y)
272 assert not y.equals(x)
273 assert x != y
274
275 eq(pa.chunked_array([], type=pa.int32()),
276 pa.chunked_array([], type=pa.int32()))
277 ne(pa.chunked_array([], type=pa.int32()),
278 pa.chunked_array([], type=pa.int64()))
279
280 a = pa.array([0, 2], type=pa.int32())
281 b = pa.array([0, 2], type=pa.int64())
282 c = pa.array([0, 3], type=pa.int32())
283 d = pa.array([0, 2, 0, 3], type=pa.int32())
284
285 eq([a], [a])
286 ne([a], [b])
287 eq([a, c], [a, c])
288 eq([a, c], [d])
289 ne([c, a], [a, c])
290
291 # ARROW-4822
292 assert not pa.chunked_array([], type=pa.int32()).equals(None)
293
294
295@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 5

chunked_arrayMethod · 0.80
equalsMethod · 0.80
eqFunction · 0.70
neFunction · 0.70
arrayMethod · 0.45

Tested by

no test coverage detected