MCPcopy Create free account
hub / github.com/PAIR-code/lit / test_pred_lock_key

Method test_pred_lock_key

lit_nlp/lib/caching_test.py:120–134  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

118 self.assertEqual("test", cache.get(("a", "1")))
119
120 def test_pred_lock_key(self):
121 cache = caching.PredsCache("test")
122 cache_key = [("a", "1"), ("a", "2")]
123
124 self.assertIsNone(cache.pred_lock_key(cache_key))
125
126 cache.get_pred_lock(cache_key)
127 expected_cache_key = frozenset(cache_key)
128 self.assertEqual(expected_cache_key, cache.pred_lock_key(cache_key))
129
130 sub_cache_key = [("a", "1")]
131 self.assertEqual(expected_cache_key, cache.pred_lock_key(sub_cache_key))
132
133 mismatch_cache_key = [("b", "1")]
134 self.assertIsNone(cache.pred_lock_key(mismatch_cache_key))
135
136 def test_pred_lock_key_no_concurrent_predictions(self):
137 cache = caching.PredsCache("test", False)

Callers

nothing calls this directly

Calls 2

pred_lock_keyMethod · 0.95
get_pred_lockMethod · 0.95

Tested by

no test coverage detected