Preserve separator in core path ops #67
Merged
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.
This pull request improves the handling of custom path separators in the
BasePathclass and ensures that all relevant methods and operations respect the separator specified by the user. It also adds comprehensive tests to verify this behavior.Enhancements to separator handling in
BasePath:with_nameto check for the instance's separator instead of a global constant, ensuring correct validation for custom separators.is_relative_toandrelative_toto pass the instance's separator toparse_args, guaranteeing correct parsing when custom separators are used. [1] [2]__rtruediv__to preserve the separator when constructing new paths, so that operations like"a" / BasePath("b.c", separator=".")maintain the correct separator.Expanded test coverage for custom separators:
test_preserves_separatorto verify that the separator is preserved in division operations.test_with_name_respects_separatorto ensure thatwith_nameraises an error when the new name contains the custom separator.test_relative_to_and_is_relative_to_custom_separatorto check that relative path operations work correctly with custom separators.