(obj)
| 576 | pa.schema({'foo': pa.int32()})], |
| 577 | ids=['type', 'field', 'schema']) |
| 578 | def test_roundtrip_schema_capsule(obj): |
| 579 | gc.collect() # Make sure no Arrow data dangles in a ref cycle |
| 580 | old_allocated = pa.total_allocated_bytes() |
| 581 | |
| 582 | capsule = obj.__arrow_c_schema__() |
| 583 | assert PyCapsule_IsValid(capsule, b"arrow_schema") == 1 |
| 584 | assert pa.total_allocated_bytes() > old_allocated |
| 585 | obj_out = type(obj)._import_from_c_capsule(capsule) |
| 586 | assert obj_out == obj |
| 587 | |
| 588 | assert pa.total_allocated_bytes() == old_allocated |
| 589 | |
| 590 | capsule = obj.__arrow_c_schema__() |
| 591 | |
| 592 | assert pa.total_allocated_bytes() > old_allocated |
| 593 | del capsule |
| 594 | assert pa.total_allocated_bytes() == old_allocated |
| 595 | |
| 596 | |
| 597 | @pytest.mark.parametrize('arr,schema_accessor,bad_type,good_type', [ |
nothing calls this directly
no test coverage detected