File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,9 @@ def __init__(self, env_file_path=None):
40
40
if self ._path and self ._path .exists ():
41
41
self ._cache .update (read_json (self ._path ))
42
42
43
+ def __contains__ (self , key ):
44
+ return key in self ._cache
45
+
43
46
def __getitem__ (self , key ):
44
47
return self ._cache .get (key )
45
48
Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ def test_JsonFileCache(monkeypatch):
92
92
cache = JsonFileCache ("INFO_FILE" )
93
93
94
94
assert cache ._path .exists ()
95
+ assert "key" in cache
95
96
assert cache .get ("key" ) == "value"
96
97
assert cache ["key" ] == "value"
97
98
assert cache .get ("other" ) is None
@@ -108,3 +109,4 @@ def test_JsonFileCache_no_file():
108
109
assert cache ._cache == {}
109
110
assert cache ._path is None
110
111
assert cache .get ("key" ) is None
112
+ assert "key" not in cache
You can’t perform that action at this time.
0 commit comments