Skip to content

feat: new module, dictknife.sort -- for flexible sorting in diff check?#73

Open
podhmo wants to merge 3 commits into
masterfrom
refine-normalize
Open

feat: new module, dictknife.sort -- for flexible sorting in diff check?#73
podhmo wants to merge 3 commits into
masterfrom
refine-normalize

Conversation

@podhmo
Copy link
Copy Markdown
Owner

@podhmo podhmo commented Nov 14, 2018

No description provided.

@podhmo podhmo force-pushed the master branch 2 times, most recently from dd12b99 to 12e1c7b Compare February 7, 2019 18:47
@podhmo
Copy link
Copy Markdown
Owner Author

podhmo commented Jul 5, 2025

This pull request introduces a new flexible sorting mechanism in dictknife and provides comprehensive tests to ensure correctness and robustness. The main changes include the implementation of the sorting logic in dictknife/sort.py and the addition of unit tests in dictknife/tests/test_sort.py.

Sorting Mechanism Implementation:

  • Flexible Sorting Functionality: Added the sort_flexibly function, which can sort various data structures (lists, dictionaries, etc.) based on a consistent and hierarchical UID system. This includes helper classes (_Atom, _Collection, _Dict) to wrap and sort elements according to their type and value. (dictknife/sort.py, dictknife/sort.pyR1-R137)

Testing Enhancements:

  • Unit Tests for Wrapping Logic: Added a WrapTests class to test the _wrap function, ensuring that elements are correctly wrapped and sorted based on their UID. (dictknife/tests/test_sort.py, dictknife/tests/test_sort.pyR1-R121)
  • Unit Tests for Flexible Sorting: Added a Tests class to validate the sort_flexibly function across a variety of input scenarios, including primitive types, nested structures, and missing values. (dictknife/tests/test_sort.py, dictknife/tests/test_sort.pyR1-R121)

@podhmo podhmo changed the title Refine normalize feat: new module, dictknife.sort -- for flexible sorting in diff check? Jul 5, 2025
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