gabriel / muse public
test_transport_no_legacy_pack.py python
101 lines 3.3 KB
Raw
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 138 days ago
1 """Guard tests — legacy pack machinery must not exist on any transport class.
2
3 These tests fail while the dead code is present and pass once it is deleted.
4 They permanently prevent the old fetch_pack / push_pack path from being
5 re-introduced.
6
7 Covered invariants
8 ------------------
9 - ``HttpTransport`` has no fetch_pack, push_pack, fetch_objects,
10 _iter_object_stream
11 - ``LocalFileTransport`` has no fetch_pack, push_pack, fetch_objects,
12 push_objects, push_object_pack, filter_objects,
13 presign_objects, confirm_objects
14 - ``MuseTransport`` has no fetch_pack
15 - ``muse.core.transport`` module exports no dead TypedDicts:
16 FilterObjectsResult, PresignResponse, ConfirmObjectsResponse, _PushPayload
17 """
18
19 from __future__ import annotations
20
21 import pytest
22
23
24 # ---------------------------------------------------------------------------
25 # MuseTransport — abstract base must not declare fetch_pack
26 # ---------------------------------------------------------------------------
27
28
29 class TestMuseTransportNoLegacy:
30 def test_no_fetch_pack(self) -> None:
31 from muse.core.transport import MuseTransport
32 assert not hasattr(MuseTransport, "fetch_pack"), (
33 "MuseTransport.fetch_pack is dead — delete it"
34 )
35
36
37 # ---------------------------------------------------------------------------
38 # HttpTransport
39 # ---------------------------------------------------------------------------
40
41
42 class TestHttpTransportNoLegacy:
43 DEAD_METHODS = [
44 "fetch_pack",
45 "push_pack",
46 "fetch_objects",
47 "_iter_object_stream",
48 ]
49
50 @pytest.mark.parametrize("method", DEAD_METHODS)
51 def test_method_absent(self, method: str) -> None:
52 from muse.core.transport import HttpTransport
53 assert not hasattr(HttpTransport, method), (
54 f"HttpTransport.{method} is dead — delete it"
55 )
56
57
58 # ---------------------------------------------------------------------------
59 # LocalFileTransport
60 # ---------------------------------------------------------------------------
61
62
63 class TestLocalFileTransportNoLegacy:
64 DEAD_METHODS = [
65 "fetch_pack",
66 "push_pack",
67 "fetch_objects",
68 "push_objects",
69 "push_object_pack",
70 "filter_objects",
71 "presign_objects",
72 "confirm_objects",
73 ]
74
75 @pytest.mark.parametrize("method", DEAD_METHODS)
76 def test_method_absent(self, method: str) -> None:
77 from muse.core.transport import LocalFileTransport
78 assert not hasattr(LocalFileTransport, method), (
79 f"LocalFileTransport.{method} is dead — delete it"
80 )
81
82
83 # ---------------------------------------------------------------------------
84 # Dead TypedDicts must not be exported from the module
85 # ---------------------------------------------------------------------------
86
87
88 class TestNoDeadTypedDicts:
89 DEAD_NAMES = [
90 "FilterObjectsResult",
91 "PresignResponse",
92 "ConfirmObjectsResponse",
93 "_PushPayload",
94 ]
95
96 @pytest.mark.parametrize("name", DEAD_NAMES)
97 def test_not_in_module(self, name: str) -> None:
98 import muse.core.transport as mod
99 assert not hasattr(mod, name), (
100 f"muse.core.transport.{name} is a dead TypedDict — delete it"
101 )
File History 1 commit
sha256:88ac91129873e6a496e9189515aa690eb893ae25d69c8f72af141a2be5068eb3 docs: docstring sprint contract→find-symbol — idiomatic run… Sonnet 4.6 patch 138 days ago