From 4182ae3f13b729ea35acce9fa004ad33e96ab75c Mon Sep 17 00:00:00 2001 From: Edward Caunt Date: Mon, 28 Oct 2024 15:21:15 +0200 Subject: [PATCH] tests: Tweak caching tests to reflect lazy touch of Dimension bounds --- tests/test_caching.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/test_caching.py b/tests/test_caching.py index bbbb98d316..143e949168 100644 --- a/tests/test_caching.py +++ b/tests/test_caching.py @@ -663,8 +663,8 @@ def test_sparse_function(self, operate_on_empty_cache): i = u.inject(expr=u, field=u) # created: rux, ruy (radius dimensions) and spacings - # posx, posy, px, py, u_coords (as indexified), - ncreated = 2+1+2+2+2+1 + # posx, posy, px, py, u_coords (as indexified), x_m, x_M, y_m, y_M + ncreated = 2+1+2+2+2+1+4 # Note that injection is now lazy so no new symbols should be created assert len(_SymbolCache) == cur_cache_size i.evaluate @@ -684,14 +684,16 @@ def test_sparse_function(self, operate_on_empty_cache): # in the first clear_cache they were still referenced by their "parent" objects # (e.g., ru* by ConditionalDimensions, through `condition`) - assert len(_SymbolCache) == init_cache_size + 8 + assert len(_SymbolCache) == init_cache_size + 12 clear_cache() # Now we should be back to the original state except for - # pos* that belong to the abstract class - assert len(_SymbolCache) == init_cache_size + 2 + # pos* that belong to the abstract class and the dimension + # bounds (x_m, x_M, y_m, y_M) + assert len(_SymbolCache) == init_cache_size + 6 clear_cache() - # Now we should be back to the original state - assert len(_SymbolCache) == init_cache_size + # 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 def test_after_indexification(self): """