test_mpack_unpack_payload.py
python
sha256:79ffe87f5fe2ec146e35f05521218bbf54dffdb0440c07f970bad05f16efb89f
chore: merge main — carry all urllib/typing/test fixes from dev
Sonnet 4.6
minor
⚠ breaking
19 days ago
| 1 | """TDD — build_unpack_payload: client-side Step 3 payload construction. |
| 2 | |
| 3 | UP-1 mpack_key is passed through unchanged. |
| 4 | UP-2 branch defaults to "main" when not supplied. |
| 5 | UP-3 head is passed through unchanged. |
| 6 | UP-4 commits_count and blobs_count default to 0 when not supplied. |
| 7 | UP-5 All five keys are always present in the returned dict. |
| 8 | UP-6 Counts are integers, not strings. |
| 9 | """ |
| 10 | from __future__ import annotations |
| 11 | |
| 12 | from muse.core.mpack import build_unpack_payload |
| 13 | from muse.core.types import blob_id |
| 14 | |
| 15 | _KEY = blob_id(b"some mpack bytes") |
| 16 | _HEAD = blob_id(b"tip commit") |
| 17 | |
| 18 | |
| 19 | def test_up1_mpack_key_passed_through() -> None: |
| 20 | payload = build_unpack_payload(_KEY, branch="main", head=_HEAD) |
| 21 | assert payload["mpack_key"] == _KEY |
| 22 | |
| 23 | |
| 24 | def test_up2_branch_defaults_to_main() -> None: |
| 25 | payload = build_unpack_payload(_KEY, head=_HEAD) |
| 26 | assert payload["branch"] == "main" |
| 27 | |
| 28 | |
| 29 | def test_up3_head_passed_through() -> None: |
| 30 | payload = build_unpack_payload(_KEY, branch="dev", head=_HEAD) |
| 31 | assert payload["head"] == _HEAD |
| 32 | |
| 33 | |
| 34 | def test_up4_counts_default_to_zero() -> None: |
| 35 | payload = build_unpack_payload(_KEY, head=_HEAD) |
| 36 | assert payload["commits_count"] == 0 |
| 37 | assert payload["blobs_count"] == 0 |
| 38 | |
| 39 | |
| 40 | def test_up5_all_keys_always_present() -> None: |
| 41 | payload = build_unpack_payload(_KEY, head=_HEAD) |
| 42 | assert set(payload) == {"mpack_key", "branch", "head", "commits_count", "blobs_count"} |
| 43 | |
| 44 | |
| 45 | def test_up6_counts_are_integers() -> None: |
| 46 | payload = build_unpack_payload(_KEY, head=_HEAD, commits_count=3, blobs_count=12) |
| 47 | assert isinstance(payload["commits_count"], int) |
| 48 | assert isinstance(payload["blobs_count"], int) |
| 49 | assert payload["commits_count"] == 3 |
| 50 | assert payload["blobs_count"] == 12 |
File History
3 commits
sha256:79ffe87f5fe2ec146e35f05521218bbf54dffdb0440c07f970bad05f16efb89f
chore: merge main — carry all urllib/typing/test fixes from dev
Sonnet 4.6
minor
⚠
19 days ago
sha256:0bea7600d1eee83e87950be49933b1006fa9dc2c71e7c4ee748d324f61138156
chore: bump version to 0.2.0rc11; fix typing audit violatio…
Sonnet 4.6
minor
⚠
19 days ago
sha256:36c3cb3e76619d4c30a6d9bf81b5ec4ff148e30dcfed913e3114ca7b43b81c7e
fix: rename objects→blobs in push client and all stale test…
Sonnet 4.6
patch
22 days ago