def test_role_model_can_object_map_for_sql_alchemy(get_role): """.""" role = models.role_factory(STORAGE_STRATEGY, **get_role()) # Raises exception if not ORM model. object_mapper(role) assert isinstance(role, sql.Role)
def test_user_model_can_object_map_for_sql_alchemy(get_user): """.""" user = models.user_factory(STORAGE_STRATEGY, **get_user()) # Raises exception if not ORM model. object_mapper(user) assert isinstance(user, sql.User)
def test_permission_model_can_object_map_for_sql_alchemy(get_permission): """.""" permission = models.permission_factory(STORAGE_STRATEGY, **get_permission()) # Raises exception if not ORM model. object_mapper(permission) assert isinstance(permission, sql.Permission)
def is_mapped(v): if v is None: return v try: object_mapper(v) except UnmappedInstanceError: return None return v
def is_mapped(value): """ Check if value is an ORM mapped object :param value: Input value :type value: Multiple type :return: True if mapped otherwise false :rtype: Boolean """ try: object_mapper(value) return True except UnmappedInstanceError: return False
def is_mapped(obj): try: object_mapper(obj) except UnmappedInstanceError: return False return True
def _is_sa_object_mapped(obj): try: object_mapper(obj) except UnmappedInstanceError: return False return True