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

Function test_chunked_array_equals

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

Source from the content-addressed store, hash-verified

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