@@ -33,13 +33,13 @@ def bar(self):
3333 assert foo .call_count == 1
3434
3535
36- def test_generation_cache_context ():
37- assert cache .generation_cache .get () is None
38- with cache .generation_cache_context ():
39- assert isinstance (cache .generation_cache .get (), dict )
40- cache .generation_cache .get ()["foo" ] = "bar"
41- assert cache .generation_cache .get ()["foo" ] == "bar"
42- assert cache .generation_cache .get () is None
36+ # def test_generation_cache_context():
37+ # assert cache.generation_cache.get() is None
38+ # with cache.generation_cache_context():
39+ # assert isinstance(cache.generation_cache.get(), dict)
40+ # cache.generation_cache.get()["foo"] = "bar"
41+ # assert cache.generation_cache.get()["foo"] == "bar"
42+ # assert cache.generation_cache.get() is None
4343
4444
4545def test_cached_proto_context ():
@@ -67,16 +67,16 @@ def with_context(self, collisions, *, skip_fields=False, visited_messages=None):
6767 foo .call_count = 0
6868
6969 # A. Basic Cache Hit
70- assert foo .with_context ({"a" }) == "val-1"
71- assert foo .with_context ({"a" }) == "val-1" # Hit
70+ assert foo .with_context (collisions = {"a" }) == "val-1" , "a "
71+ assert foo .with_context (collisions = {"a" }) == "val-1" # Hit
7272 assert foo .call_count == 1
7373
7474 # B. Collision Difference
7575 # Changing collisions creates a new key
76- assert foo .with_context ({"b" }) == "val-2"
76+ assert foo .with_context (collisions = {"b" }) == "val-2"
7777 assert foo .call_count == 2
7878
7979 # 3. Context Cleared
8080 # Everything should be forgotten now.
81- assert cache .generation_cache . get ( ) is None
82- assert foo .with_context ({"a" }) == "val-7 "
81+ assert getattr ( cache ._thread_local , "cache" , None ) is None
82+ assert foo .with_context (collisions = {"a" }) == "val-3 "
0 commit comments