def test_uuid(self):
    doc = {'uuid': uuid.UUID('f47ac10b-58cc-4372-a567-0e02b2c3d479')}
    self.round_trip(doc)
    self.assertEqual('{"uuid": {"$uuid": "EXAMPLE_KEY"}}', json_util.dumps(doc))
    self.assertEqual('{"uuid": {"$binary": "9HrBC1jMQ3KlZw4CssPUeQ==", "$type": "03"}}', json_util.dumps(doc, json_options=json_util.STRICT_JSON_OPTIONS))
    self.assertEqual('{"uuid": {"$binary": "9HrBC1jMQ3KlZw4CssPUeQ==", "$type": "04"}}', json_util.dumps(doc, json_options=json_util.JSONOptions(strict_uuid=True, uuid_representation=STANDARD)))
    self.assertEqual(doc, json_util.loads('{"uuid": {"$binary": "9HrBC1jMQ3KlZw4CssPUeQ==", "$type": "03"}}'))
    for uuid_representation in (set(ALL_UUID_REPRESENTATIONS) - {UuidRepresentation.UNSPECIFIED}):
        options = json_util.JSONOptions(strict_uuid=True, uuid_representation=uuid_representation)
        self.round_trip(doc, json_options=options)
        self.assertEqual(doc, json_util.loads('{"uuid": {"$binary": "9HrBC1jMQ3KlZw4CssPUeQ==", "$type": "04"}}', json_options=options))
def test_uuid(self):
    doc = {'uuid': uuid.UUID('f47ac10b-58cc-4372-a567-0e02b2c3d479')}
    self.round_trip(doc)
    self.assertEqual('{"uuid": {"$uuid": "EXAMPLE_KEY"}}', json_util.dumps(doc))
    self.assertEqual('{"uuid": {"$binary": "9HrBC1jMQ3KlZw4CssPUeQ==", "$type": "03"}}', json_util.dumps(doc, json_options=json_util.STRICT_JSON_OPTIONS))
    self.assertEqual('{"uuid": {"$binary": "9HrBC1jMQ3KlZw4CssPUeQ==", "$type": "04"}}', json_util.dumps(doc, json_options=json_util.JSONOptions(strict_uuid=True, uuid_representation=STANDARD)))
    self.assertEqual(doc, json_util.loads('{"uuid": {"$binary": "9HrBC1jMQ3KlZw4CssPUeQ==", "$type": "03"}}'))
    for uuid_representation in (set(ALL_UUID_REPRESENTATIONS) - {UuidRepresentation.UNSPECIFIED}):
        options = json_util.JSONOptions(strict_uuid=True, uuid_representation=uuid_representation)
        self.round_trip(doc, json_options=options)
        self.assertEqual(doc, json_util.loads('{"uuid": {"$binary": "9HrBC1jMQ3KlZw4CssPUeQ==", "$type": "04"}}', json_options=options))