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

Function test_buffer_equals

python/pyarrow/tests/test_io.py:525–551  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

523
524@pytest.mark.numpy
525def test_buffer_equals():
526 # Buffer.equals() returns true iff the buffers have the same contents
527 def eq(a, b):
528 assert a.equals(b)
529 assert a == b
530 assert not (a != b)
531
532 def ne(a, b):
533 assert not a.equals(b)
534 assert not (a == b)
535 assert a != b
536
537 b1 = b'some data!'
538 b2 = bytearray(b1)
539 b3 = bytearray(b1)
540 b3[0] = 42
541 buf1 = pa.py_buffer(b1)
542 buf2 = pa.py_buffer(b2)
543 buf3 = pa.py_buffer(b2)
544 buf4 = pa.py_buffer(b3)
545 buf5 = pa.py_buffer(np.frombuffer(b2, dtype=np.int16))
546 eq(buf1, buf1)
547 eq(buf1, buf2)
548 eq(buf2, buf3)
549 ne(buf2, buf4)
550 # Data type is indifferent
551 eq(buf2, buf5)
552
553
554def test_buffer_eq_bytes():

Callers

nothing calls this directly

Calls 2

eqFunction · 0.70
neFunction · 0.70

Tested by

no test coverage detected