def test_create_timeuuid_with_uuid4_string_should_fail(self):
''' creating a TimeUUID with a hex uuid4 should fail'''
for i in range(1,100):
u = uuid.uuid4()
with self.assertRaises(ValueError) as cm:
t = timeuuid.TimeUUID(s=u.hex)
self.assertEqual(str(cm.exception), 'Invalid UUID type')
for fn in [uuid.uuid3, uuid.uuid5]:
for i in range(1,100):
u = fn(uuid.NAMESPACE_DNS,str(os.urandom(10)))
with self.assertRaises(ValueError) as cm:
t = timeuuid.TimeUUID(s=u.hex)
self.assertEqual(str(cm.exception), 'Invalid UUID type')
评论列表
文章目录