def test_fromstring(self): import uuid from plone.uuid.interfaces import IUUIDObject uid = uuid.uuid4() hexuid = uid.hex fielded_uid = str(uid) self.assertEqual(uid, IUUIDObject(hexuid), IUUIDObject(fielded_uid))
def test_iuuid_from_uuid(self): import uuid from plone.uuid.interfaces import IUUID uid = uuid.uuid4() self.assertEqual(str(uid), IUUID(uid, None))
def test_fromuuid(self): """Test adaptation to IUUIDObject from uuid.UUID no cast""" import uuid from plone.uuid.interfaces import IUUIDObject uid = uuid.uuid4() self.assertTrue(IUUIDObject(uid) is uid)
def test_provides(self): import uuid from plone.uuid.interfaces import IUUIDObject, IUUID self.assertTrue(IUUIDObject.providedBy(uuid.uuid4())) self.assertFalse(IUUID.providedBy(uuid.uuid4()))