MCPcopy Create free account
hub / github.com/idank/explainshell / TestClassifyAlreadyStored

Class TestClassifyAlreadyStored

tests/extraction/test_prefilter.py:244–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242
243
244class TestClassifyAlreadyStored(unittest.TestCase):
245 def setUp(self) -> None:
246 _PATCH_SOURCE.start()
247 self.addCleanup(_PATCH_SOURCE.stop)
248
249 @patch("os.path.islink", return_value=False)
250 def test_already_stored_no_overwrite(self, _il) -> None:
251 s = _FakeStore(sources_in_db={"u/26.04/1/foo.1.gz"})
252 c = _make_classifier(s)
253 self.assertIsInstance(c.classify("/x/u/26.04/1/foo.1.gz"), AlreadyStored)
254
255 @patch("os.path.islink", return_value=False)
256 @patch("explainshell.extraction.common.gz_sha256", return_value="h")
257 def test_overwrite_skips_already_stored_branch(self, _h, _il) -> None:
258 s = _FakeStore(sources_in_db={"u/26.04/1/foo.1.gz"})
259 c = _make_classifier(s, overwrite=True)
260 # No filter, no dedup hit → falls through to Work.
261 self.assertIsInstance(c.classify("/x/u/26.04/1/foo.1.gz"), Work)
262
263
264class TestClassifyContentDup(unittest.TestCase):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected