MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_decoding_1

Method test_decoding_1

test/test_binary.py:327–341  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

325
326 # Explicit decoding prose test #1
327 def test_decoding_1(self):
328 obj = Binary(self._hex_to_bytes("00112233445566778899AABBCCDDEEFF"), 4)
329
330 # Case i:
331 self.assertEqual(obj.as_uuid(), self.uuid)
332 # Case ii:
333 self.assertEqual(obj.as_uuid(UuidRepresentation.STANDARD), self.uuid)
334 # Cases iii-vi:
335 for uuid_rep in (
336 UuidRepresentation.JAVA_LEGACY,
337 UuidRepresentation.CSHARP_LEGACY,
338 UuidRepresentation.PYTHON_LEGACY,
339 ):
340 with self.assertRaises(ValueError):
341 obj.as_uuid(uuid_rep)
342
343 def _test_decoding_legacy(self, hexstring, uuid_rep):
344 obj = Binary(self._hex_to_bytes(hexstring), 3)

Callers

nothing calls this directly

Calls 3

_hex_to_bytesMethod · 0.95
as_uuidMethod · 0.95
BinaryClass · 0.85

Tested by

no test coverage detected