()
| 32 | |
| 33 | |
| 34 | def test_chunked_array_basics(): |
| 35 | data = pa.chunked_array([], type=pa.string()) |
| 36 | assert data.type == pa.string() |
| 37 | assert data.to_pylist() == [] |
| 38 | data.validate() |
| 39 | |
| 40 | data2 = pa.chunked_array([], type='binary') |
| 41 | assert data2.type == pa.binary() |
| 42 | |
| 43 | with pytest.raises(ValueError): |
| 44 | pa.chunked_array([]) |
| 45 | |
| 46 | data = pa.chunked_array([ |
| 47 | [1, 2, 3], |
| 48 | [4, 5, 6], |
| 49 | [7, 8, 9] |
| 50 | ]) |
| 51 | assert isinstance(data.chunks, list) |
| 52 | assert all(isinstance(c, pa.lib.Int64Array) for c in data.chunks) |
| 53 | assert all(isinstance(c, pa.lib.Int64Array) for c in data.iterchunks()) |
| 54 | assert len(data.chunks) == 3 |
| 55 | assert data.get_total_buffer_size() == sum(c.get_total_buffer_size() |
| 56 | for c in data.iterchunks()) |
| 57 | assert sys.getsizeof(data) >= object.__sizeof__( |
| 58 | data) + data.get_total_buffer_size() |
| 59 | assert data.nbytes == 3 * 3 * 8 # 3 items per 3 lists with int64 size(8) |
| 60 | data.validate() |
| 61 | |
| 62 | wr = weakref.ref(data) |
| 63 | assert wr() is not None |
| 64 | del data |
| 65 | assert wr() is None |
| 66 | |
| 67 | |
| 68 | def test_chunked_array_construction(): |
nothing calls this directly
no test coverage detected