Skip to content

Commit

Permalink
Updated test_bson for new as_vector API
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyclements committed Sep 20, 2024
1 parent 41ee0bb commit 9d52aeb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions test/test_bson.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ def test_vector(self):
packed_bit_vec = packed_bit_binary.as_vector()
assert packed_bit_vec.data == list_vector
# If we wish to see the bit vector unpacked to its true length, we can
unpacked_vec = packed_bit_binary.as_vector(BinaryVectorDtype.INT8)
unpacked_vec = packed_bit_binary.as_vector(uncompressed=True)
assert len(unpacked_vec.data) == 8 * len(list_vector)
assert set(unpacked_vec.data) == {0, 1}

Expand All @@ -758,9 +758,7 @@ def test_vector(self):
padding = 3
padded_vec = Binary.from_vector(list_vector, BinaryVectorDtype.PACKED_BIT, padding=padding)
assert padded_vec.as_vector().data == list_vector
assert (
len(padded_vec.as_vector(BinaryVectorDtype.INT8).data) == 8 * len(list_vector) - padding
)
assert len(padded_vec.as_vector(uncompressed=True).data) == 8 * len(list_vector) - padding

# It is worthwhile explicitly showing the values encoded to BSON
padded_doc = {"padded_vec": padded_vec}
Expand Down

0 comments on commit 9d52aeb

Please sign in to comment.