Skip to content

HelpersTask579-add-unit-tests-for-sort_config_string#645

Open
neomisule wants to merge 4 commits intomasterfrom
HelpersTask579-add-unit-tests-for-sort_config_string
Open

HelpersTask579-add-unit-tests-for-sort_config_string#645
neomisule wants to merge 4 commits intomasterfrom
HelpersTask579-add-unit-tests-for-sort_config_string

Conversation

@neomisule
Copy link
Contributor

Link to Issue: #579

Added unit tests, the existing function may need to be revised.

FYI @sonniki @samarth9008 @gpsaggese

@neomisule neomisule requested review from samarth9008 and sonniki May 1, 2025 18:17
@neomisule neomisule self-assigned this May 1, 2025
@neomisule neomisule added the PR for reviewers The PR needs to be reviewed by RPs label May 1, 2025
key2:
key3:
key4:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you remove these empty lines or was that Linter? Here and also twice below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I didn't, it was the linter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls let's revert these Linter changes. I'll file an issue because it's some erroneous formatting


class TestSortConfigString(hunitest.TestCase):
"""
Test sort_config_string function with various config formats.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls use backticks for the function name

"""
Helper method to test sorted config output.
"""
result = cconfig.sort_config_string(txt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By convention, we call it actual



# #############################################################################
# TestSortConfigString
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file where this class is located is wrong. Since the original function is in config_utils.py, its test should be in test_config_utils.py

# #############################################################################


class TestSortConfigString(hunitest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test cases themselves look good. Feel free to fix the bug in the function and you can use these tests to confirm that the fix works.

Comment on lines +2560 to +2564
wrong_indent: value2
config2:
extra_indent: value3
single: value4
bad_indent: value5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it expected that wrong_indent and bad_indent get removed? My understanding was that the function is only about sorting alphabetically. Does it also validate indentation? Maybe it can be added to the docstring in that case.

@sonniki sonniki added PR for authors The PR needs changes and removed PR for reviewers The PR needs to be reviewed by RPs labels May 2, 2025
@sonniki sonniki requested a review from gpsaggese May 2, 2025 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR for authors The PR needs changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants