-
Notifications
You must be signed in to change notification settings - Fork 245
DRIVERS-3123 add test skip and clarification #1819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PyMongo 4.14.0-dev raises an exception
assert b1 == Binary(b'\x10\x07\x80', subtype=9) # This is effectively a roundtrip. | ||
v1 = Binary.as_vector(b1) | ||
b1 = Binary(b'\x10\x07\x80', subtype=9) | ||
b2 = Binary(b'\x10\x07\xff', subtype=9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this. Thank you for catching the oversight! I'd still like the example of equality though.
assert b1 == Binary.from_vector([0b10000000], BinaryVectorDtype.PACKED_BIT, padding=7)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added another value with the same data representation as b1
to add equality comparisons.
While here, I also realized it may not be reasonable to assume every driver may support constructing a Vector
type with non-zero ignored bits. I added another condition to skip this test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline. Used the form b3 = Binary.from_vector([0b10000000], BinaryVectorDtype.PACKED_BIT, padding=7)
to express the data in the base-literal notation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Follow-up to #1812. Applies pending suggestions from review:
Allow drivers to skip the comparison test if the
Vector
type does not support comparison. The C driver's bson_vector_packed_bit_view_t does not support comparison.Do not use
Binary.from_vector
in test example with non-zero ignored bits. PyMongo 4.14.0-dev raises an exception:Please complete the following before merging:
[ ] Update changelog.[ ] Test changes in at least one language driver.[ ] Test these changes against all server versions and topologies (including standalone, replica set, and shardedclusters).