Skip to content

test: add 10 tests for checkpoints module (re-land of #7) - #12

Merged
marksverdhei merged 1 commit into
mainfrom
reland/markutils-7-checkpoints-tests
Jun 27, 2026
Merged

marksverdhei merged 1 commit into
mainfrom
reland/markutils-7-checkpoints-tests

Conversation

@marksverdhei

Copy link
Copy Markdown
Owner

Draft re-land of #7 — hai-pilgrim's PR was 3 months stale and its commit had a Co-Authored-By: Claude trailer (can't ship per repo convention). Test file was new (no conflict). Also fixed 2 ruff violations the original had (unused pytest import, E741 l → line).

Summary

10 unit tests for markutils.checkpoints covering print_state_dict_shapes and get_state_dict. All tensor I/O mocked — no real .safetensors files needed.

Test plan

  • pytest tests/test_checkpoints.py → 10 passed
  • full suite → 34 passed
  • uvx ruff check clean
  • CI / your review

Draft so you can decide between this and asking hai-pilgrim to rebase #7 directly.

print_state_dict_shapes:
- prints each key
- keys appear in sorted order
- empty dict prints nothing
- shape appears in output
- single-key dict

get_state_dict:
- returns dict
- all keys from the safetensors file present
- tensor values returned via safe_open's get_tensor
- empty checkpoint returns empty dict
- safe_open called with framework='pt' and device='cpu'

Tensor I/O is mocked via unittest.mock — no real .safetensors files
required. Re-land of #7 (hai-pilgrim's PR had Co-Authored-By trailer
that can't ship per repo convention); also dropped unused pytest import
and renamed E741 'l' to 'line'.
@marksverdhei
marksverdhei marked this pull request as ready for review June 27, 2026 14:59
@marksverdhei
marksverdhei merged commit e76121a into main Jun 27, 2026
2 checks passed
@marksverdhei
marksverdhei deleted the reland/markutils-7-checkpoints-tests branch June 27, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant