From abf00f861fd54e1d03361828c47d9c527f4096ab Mon Sep 17 00:00:00 2001 From: Edward Caunt Date: Wed, 6 Nov 2024 11:53:02 +0000 Subject: [PATCH] tests: Update caching test and fix minor decomposition bug --- devito/data/decomposition.py | 2 +- tests/test_caching.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/devito/data/decomposition.py b/devito/data/decomposition.py index 7fad455d33..b111fe8217 100644 --- a/devito/data/decomposition.py +++ b/devito/data/decomposition.py @@ -320,7 +320,7 @@ def index_glb_to_loc(self, *args, rel=True): if self.loc_empty: return None abs_ofs, side = args - if side is LEFT: + if side == LEFT: rel_ofs = self.glb_min + abs_ofs - base if abs_ofs >= base and abs_ofs <= top: return rel_ofs diff --git a/tests/test_caching.py b/tests/test_caching.py index bdf2bb1c67..93200d3d73 100644 --- a/tests/test_caching.py +++ b/tests/test_caching.py @@ -694,6 +694,11 @@ def test_sparse_function(self, operate_on_empty_cache): # Now we should be back to the original state plus the dimension bounds # (x_m, x_M, y_m, y_M) assert len(_SymbolCache) == init_cache_size + 4 + # Delete the grid and check that all symbols are subsequently garbage collected + del grid + for n in (10, 3, 0): + clear_cache() + assert len(_SymbolCache) == n def test_after_indexification(self): """