diff --git a/src/linkahead/apiutils.py b/src/linkahead/apiutils.py index fe79d5fc750f529021a8b5ea5c141f0a317d346f..0093233e2c9fbbfd2f24767c923f210a94346fe2 100644 --- a/src/linkahead/apiutils.py +++ b/src/linkahead/apiutils.py @@ -327,7 +327,7 @@ def compare_entities(old_entity: Entity, new_entity: Entity, try: same = empty_diff(val0, val1, False, entity_name_id_equivalency) - except: + except (ValueError, NotImplementedError): same = False if same: continue diff --git a/src/linkahead/cached.py b/src/linkahead/cached.py index cf1d1d34362335f87c5eca094b5aa9d6b750f68d..6715c16629659ff79ea66de7fea127f81317bf3c 100644 --- a/src/linkahead/cached.py +++ b/src/linkahead/cached.py @@ -116,7 +116,7 @@ All additional arguments are at their default values. return result -@ lru_cache(maxsize=DEFAULT_SIZE) +@lru_cache(maxsize=DEFAULT_SIZE) def _cached_access(kind: AccessType, value: Union[str, int], unique: bool = True): # This is the function that is actually cached. # Due to the arguments, the cache has kind of separate sections for cached_query and diff --git a/unittests/test_apiutils.py b/unittests/test_apiutils.py index 2688caedb38f88c00055aa1d0cebafb7f3cbc0c5..4c529e36a86474500cbaf911df932a89af592d77 100644 --- a/unittests/test_apiutils.py +++ b/unittests/test_apiutils.py @@ -343,14 +343,8 @@ def test_compare_entities_battery(): # Order invariance t7 = db.Property(**prop_settings).add_parent(par1).add_property(prop1) t8 = db.Property(**alt_settings).add_parent(par3).add_property(prop3) - try: - diffs_0 = compare_entities(t7, t8), compare_entities(t7, t8, True) - except: - diffs_0 = None - try: - diffs_1 = compare_entities(t8, t7)[::-1], compare_entities(t8, t7, True)[::-1] - except: - diffs_1 = None + diffs_0 = compare_entities(t7, t8), compare_entities(t7, t8, True) + diffs_1 = compare_entities(t8, t7)[::-1], compare_entities(t8, t7, True)[::-1] assert diffs_0 == diffs_1 prop_settings = {"datatype": db.REFERENCE, "description": "desc of prop", "value": db.Record().add_parent(par3), "unit": '°'}