tests: Test fstring nested replacement fields.#18495
tests: Test fstring nested replacement fields.#18495jepler wants to merge 1 commit intomicropython:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18495 +/- ##
=======================================
Coverage 98.38% 98.38%
=======================================
Files 171 171
Lines 22301 22301
=======================================
Hits 21940 21940
Misses 361 361 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
When I read 'nested' I thought this was about Nitpick: perhaps this should be named 'f-string with nested brackets' ? |
2d0ecef to
9756bb1
Compare
Good idea. I re-titled and re-worded, but I used the term "curly braces" same as the cpython documentation. |
Thanks, makes sense. Can you change it in the comment on the test as well? |
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
9756bb1 to
c734ae9
Compare
|
I've revised yet again what this test fragment explains it is testing. The CPython docs end up explaining it like this:
This is different than the following cases of nested curly braces: |
dpgeorge
left a comment
There was a problem hiding this comment.
Thanks for the test.
I didn't realise that MicroPython supported this!
|
Rebased and merged in ef567dc |
Summary
I was not able to find an explicit test for "fstring nested replacement fields", like
f"{x:{space}.{prec}}". So I added several cases to the existing teststring_fstring.py.Testing
I locally ran
make test//fstringin the unix port.Trade-offs and Alternatives
Are there more cases that should be tested?
Should the test be in its own file?
This does not actually cover any additional lines but unless I overlooked an existing test it does cover new functionality not previously covered.