def test_uuid_uuid_rep_unspecified(self):
    _uuid = uuid.uuid4()
    options = json_util.JSONOptions(strict_uuid=True, uuid_representation=UuidRepresentation.UNSPECIFIED)
    doc = {'uuid': _uuid}
    with self.assertRaises(ValueError):
        json_util.dumps(doc, json_options=options)
    doc = {'uuid': Binary(_uuid.bytes, subtype=3)}
    ext_json_str = json_util.dumps(doc)
    self.assertEqual(doc, json_util.loads(ext_json_str, json_options=options))
    doc = {'uuid': Binary(_uuid.bytes, subtype=4)}
    ext_json_str = json_util.dumps(doc)
    self.assertEqual(doc, json_util.loads(ext_json_str, json_options=options))
    doc = {'uuid': Binary(_uuid.bytes, subtype=4)}
    ext_json_str = json_util.dumps({'uuid': _uuid})
    self.assertEqual(doc, json_util.loads(ext_json_str, json_options=options))
def test_uuid_uuid_rep_unspecified(self):
    _uuid = uuid.uuid4()
    options = json_util.JSONOptions(strict_uuid=True, uuid_representation=UuidRepresentation.UNSPECIFIED)
    doc = {'uuid': _uuid}
    with self.assertRaises(ValueError):
        json_util.dumps(doc, json_options=options)
    doc = {'uuid': Binary(_uuid.bytes, subtype=3)}
    ext_json_str = json_util.dumps(doc)
    self.assertEqual(doc, json_util.loads(ext_json_str, json_options=options))
    doc = {'uuid': Binary(_uuid.bytes, subtype=4)}
    ext_json_str = json_util.dumps(doc)
    self.assertEqual(doc, json_util.loads(ext_json_str, json_options=options))
    doc = {'uuid': Binary(_uuid.bytes, subtype=4)}
    ext_json_str = json_util.dumps({'uuid': _uuid})
    self.assertEqual(doc, json_util.loads(ext_json_str, json_options=options))