-
Notifications
You must be signed in to change notification settings - Fork 1.3k
implement str.translate and str.maketrans #943
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
Conversation
vm/src/obj/objstr.rs
Outdated
@@ -1104,4 +1139,34 @@ mod tests { | |||
assert!(!PyString::from(s).istitle(&vm)); | |||
} | |||
} | |||
|
|||
#[test] | |||
fn str_translate() { |
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.
We also add python snippets under tests/snippets
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.
Are you using the latest rust toolchain?
You are right my default toolchain is stable which has different rustfmt
than nightly
. Now formatting with cargo +nightly fmt
and it seems all formatting problemsa are fixed now!
Instead of manual formatting, run |
I was already using |
Are you using the latest rust toolchain? |
whats_left.sh
Outdated
@@ -8,4 +8,4 @@ python3 not_impl_gen.py | |||
|
|||
cd .. | |||
|
|||
cargo run -- tests/snippets/whats_left_to_implement.py | |||
cargo +nightly run -- tests/snippets/whats_left_to_implement.py |
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.
Please leave this file as it is. Other people also depend upon this one.
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.
Ok I wasn't intented to push this change but I forgot that I changed it. I will revert it back with my next commit.
@Furyzer0 thank you for contributing to this project! |
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.
This change looks good to me!
Codecov Report
@@ Coverage Diff @@
## master #943 +/- ##
==========================================
+ Coverage 64.79% 64.87% +0.08%
==========================================
Files 89 91 +2
Lines 15881 16271 +390
Branches 3587 3692 +105
==========================================
+ Hits 10290 10556 +266
- Misses 3231 3259 +28
- Partials 2360 2456 +96
Continue to review full report at Codecov.
|
It seems both functions work and all tests have passed. Tomorrow I will add the unit test for |
Currently
str.translate
is working. This is my first contribution to this project so I would like to know if there is something wrong in my code.Ref: #190