I am using dogpile to have cache in my python program.
During the init of my program, I clean the cache SimpleCache.set_fault_injector(NO_VALUE)
@staticmethod
def set_fault_injector(injector):
SimpleCache.save("fault_injector", injector)
Then I retrieve the object with:
@staticmethod
def get_fault_injector():
return SimpleCache.get("fault_injector")
injector = get_fault_injector()
Here in my test, I am checking if the injector
variable is set to NO_VALUE
, but the comparison is returning False
(it should be TRUE
). How do I check if injector
is set to NO_VALUE
? The way that I clear the cache is correct?
In [3]: injector
Out[3]: <dogpile.cache.api.NoValue at 0x7fdde0dfd750>
In [4]: NO_VALUE
Out[4]: <dogpile.cache.api.NoValue at 0x7fdde16dbed0>
In [5]: injector == NO_VALUE
Out[5]: False
In [6]: type(injector)
Out[6]: dogpile.cache.api.NoValue
In [7]: type(NO_VALUE)
Out[7]: dogpile.cache.api.NoValue
In [8]: injector is NO_VALUE
Out[8]: False
[9]: type(injector) == type(NO_VALUE)
Out[9]: True