docs: explain model fixture and snapshot workflow - #1031
Conversation
Signed-off-by: Shurong Cao <170531907+CAOShurong@users.noreply.github.com>
Up to standards ✅🟢 Issues
|
jkowalleck
left a comment
There was a problem hiding this comment.
Thanks for the effort.
more docs -> more good!
|
|
||
| The files will be written as is, which might not be human-readable. feel free to reformat the files manually. | ||
| Only commit snapshots that belong to the model change. Since snapshots are | ||
| compared byte-for-byte, do not reformat them manually. |
There was a problem hiding this comment.
where comes this "compared byte-for-byte" from?
There was a problem hiding this comment.
Good catch — that wording was imprecise. SnapshotMixin.assertEqualSnapshot() reads fixtures in text mode and calls self.assertEqual(actual, self.readSnapshot(snapshot_name)), so this is exact string equality after text decoding/newline handling, not a raw byte comparison. I updated the README in 698c855. I also reran the focused serialization/deserialization snapshot tests (750 tests) and the full suite (6,962 tests) in UTF-8 mode; both pass.
There was a problem hiding this comment.
you are right.
This means, this part of the docs are wrong, and require changing:
Describe the exact string comparison used by SnapshotMixin without implying a raw byte comparison. Assisted-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Shurong Cao <170531907+CAOShurong@users.noreply.github.com>
Description
Document the shared BOM model fixture workflow in
tests/_data/snapshots/README.md:get_bom_*factories are discovered and named;The existing README only documented the recreation command. This fills the documentation gap identified by the maintainer in #914 without changing test behavior.
Resolves or fixes issue: #1030
Validation
python -m unittest tests.test_output_json tests.test_output_xml tests.test_deserialize_json tests.test_deserialize_xml— 750 tests passed.python -m unittest discover -t . -s tests— 6,962 tests passed.git diff --check— passed.AI Tool Disclosure
OpenAI CodexGPT-5Audit maintainer-requested CycloneDX contribution paths, verify repository rules and duplicates, document the existing tests/_data/models.py fixture and snapshot workflow, and run focused and complete regression tests.Affirmation