MCPcopy
hub / github.com/django/django / test_has_key_race_handling

Method test_has_key_race_handling

tests/cache/tests.py:1876–1880  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1874 self.assertIs(cache._is_expired(fh), True)
1875
1876 def test_has_key_race_handling(self):
1877 self.assertIs(cache.add("key", "value"), True)
1878 with mock.patch("builtins.open", side_effect=FileNotFoundError) as mocked_open:
1879 self.assertIs(cache.has_key("key"), False)
1880 mocked_open.assert_called_once()
1881
1882 def test_touch(self):
1883 """Override to manually advance time since file access can be slow."""

Callers

nothing calls this directly

Calls 3

addMethod · 0.45
patchMethod · 0.45
has_keyMethod · 0.45

Tested by

no test coverage detected