Preserve column order in YAML export (#287) - #644
Merged
claudep merged 1 commit intoJun 15, 2026
Conversation
claudep
reviewed
Jun 13, 2026
| self.assertEqual(output, expected) | ||
|
|
||
| def test_yaml_export_preserves_column_order(self): | ||
| """Regression test for #287: YAML export must keep the dataset's column order |
Contributor
There was a problem hiding this comment.
I think you could remove the "Regression test for #287" part, the rest of the patch looks totally good. Thanks!
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #644 +/- ##
==========================================
+ Coverage 93.14% 93.16% +0.01%
==========================================
Files 29 29
Lines 3226 3231 +5
==========================================
+ Hits 3005 3010 +5
Misses 221 221 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
yaml.safe_dump sorts mapping keys alphabetically by default, so YAML export reordered columns (e.g. apple, id, name, zebra) inconsistently with the CSV and JSON exports, which keep the dataset's header order. Pass sort_keys=False when dumping the dataset and databook so YAML keeps the original column order. Fixes jazzband#287 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vineethsaivs
force-pushed
the
fix/yaml-preserve-column-order
branch
from
June 15, 2026 00:10
6add9c4 to
811feda
Compare
Contributor
Author
|
Thanks for the review! I've removed the "Regression test for #287" wording from the docstring; the test now reads as a plain description of the expected behavior. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #287.
yaml.safe_dumpsorts mapping keys alphabetically by default, so YAML export reordered columns inconsistently with the CSV and JSON exports (which keep the dataset's header order):This passes
sort_keys=Falsewhen dumping the dataset and the databook, so YAML keeps the original column order (matching CSV/JSON).test_yaml_exportis updated to expect header order, and a focused regression test (test_yaml_export_preserves_column_order) is added; it fails onmaster(alphabetical) and passes with this change.Disclosure: prepared with AI assistance; reviewed by me and I can explain every line.