-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix zpath
when passing pathlib.Path
#704
Conversation
WalkthroughThe recent changes enhance the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant zpath
participant FileSystem
User->>zpath: Calls zpath("file.txt")
zpath->>FileSystem: Check if file exists
alt File exists
zpath->>FileSystem: Return file path without extension
else File does not exist
zpath->>FileSystem: Return original path
end
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/monty/os/path.py (3 hunks)
- tests/test_os.py (1 hunks)
Additional comments not posted (5)
tests/test_os.py (4)
15-28
: Good test coverage for string inputs.The function
test_zpath_str
correctly tests thezpath
function with string inputs, ensuring the return type and output are as expected.
29-36
: Good test coverage for Path inputs.The function
test_zpath_path
correctly tests thezpath
function withPath
inputs, ensuring the return type and output are as expected.
37-52
: Good test coverage for multiple extensions.The function
test_zpath_multiple_extensions
correctly tests thezpath
function with various file extensions, ensuring the output is as expected in different scenarios.
53-59
: Good test coverage for non-existent files.The function
test_zpath_nonexistent_file
correctly tests thezpath
function with non-existent files, ensuring the output is as expected.src/monty/os/path.py (1)
Line range hint
18-30
:
Good enhancement for handling Path inputs.The function
zpath
has been correctly modified to handle both string andPath
inputs, improving its flexibility. The input is converted to a string before processing, ensuring consistency.
unblocks materialsproject/atomate2#854 which is failing with
Summary by CodeRabbit
New Features
zpath
function now accepts both string andPath
object inputs for greater flexibility.Bug Fixes
zpath
function by ensuring all return values are strings, regardless of input type.Tests
zpath
function to cover various scenarios, including handling of different file extensions and non-existent files.