def test_idempotency(): ulid = ULID() assert ULID.from_bytes(ulid.bytes) == ulid assert ULID.from_str(str(ulid)) == ulid assert ULID.from_uuid(ulid.to_uuid()) == ulid assert ULID.from_int(int(ulid)) == ulid assert ULID.from_hex(ulid.hex) == ulid
def ulid(self): return ULID.from_str(self.id)