We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 640bda9 commit 1c12003Copy full SHA for 1c12003
1 file changed
tests/test_ir.py
@@ -1145,3 +1145,22 @@ def __init__(self, value: int):
1145
hits, _, _, cursize = Object._instance_cache.cache_info()
1146
assert hits == 1 # obj5 hit the cache
1147
assert cursize == 2
1148
+
1149
+ def test_cleared_after_build(self):
1150
+ """
1151
+ Tests that instance caches are cleared after building an Operator.
1152
1153
+ class Object(CacheInstances):
1154
+ def __init__(self, value: int):
1155
+ self.value = value
1156
1157
+ obj1 = Object(1)
1158
+ cache_size = Object._instance_cache.cache_info()[-1]
1159
+ assert cache_size == 1
1160
1161
+ x = Symbol('x')
1162
+ Operator(Eq(x, obj1.value))
1163
1164
+ # Cache should be cleared after Operator construction
1165
1166
+ assert cache_size == 0
0 commit comments