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

Class TestAddManpageDuplicatePrevention

tests/test_store.py:209–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207
208
209class TestAddManpageDuplicatePrevention:
210 def test_same_source_reimport_succeeds(self, store):
211 """Re-importing the same source should replace the old entry."""
212 mp = _make_manpage("ps", "1")
213 store.add_manpage(mp, _make_raw())
214 store.add_manpage(mp, _make_raw()) # should not raise
215
216 def test_same_name_section_distro_different_source_raises(self, store):
217 """Two manpages with same name+section+distro but different source should raise."""
218 mp1 = ParsedManpage(
219 source="ubuntu/26.04/1/ps.1.gz",
220 name="ps",
221 synopsis="ps - report",
222 aliases=[("ps", 10)],
223 )
224 mp2 = ParsedManpage(
225 source="ubuntu/26.04/1/procps-ps.1.gz",
226 name="ps",
227 synopsis="ps - report processes",
228 aliases=[("ps", 10)],
229 )
230 store.add_manpage(mp1, _make_raw())
231 with pytest.raises(errors.DuplicateManpage):
232 store.add_manpage(mp2, _make_raw())
233
234 def test_same_name_different_distro_succeeds(self, store):
235 """Same name+section in different distros should be allowed."""
236 mp1 = _make_manpage("ps", "1", distro="ubuntu", release="26.04")
237 mp2 = _make_manpage("ps", "1", distro="debian", release="12")
238 store.add_manpage(mp1, _make_raw())
239 store.add_manpage(mp2, _make_raw()) # should not raise
240
241 def test_same_name_different_section_succeeds(self, store):
242 """Same name in different sections within same distro should be allowed."""
243 mp1 = _make_manpage("printf", "1")
244 mp3 = _make_manpage("printf", "3")
245 store.add_manpage(mp1, _make_raw())
246 store.add_manpage(mp3, _make_raw()) # should not raise
247
248
249class TestFindManpageDistroScoping:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected