-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
replacing .format with f-strings #31628
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
pandas/tests/io/test_pickle.py
Outdated
@@ -61,7 +61,7 @@ def compare_element(result, expected, typ, version=None): | |||
assert result.freq == expected.freq | |||
else: | |||
comparator = getattr( | |||
tm, "assert_{typ}_equal".format(typ=typ), tm.assert_almost_equal | |||
tm, f"assert_{typ=typ}_equal", tm.assert_almost_equal |
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.
Thanks @drewseibert
Did you try running this test to see if it works?
pytest pandas/tests/io/test_pickle.py
(for more on testing, see Test-driven development/code writing)
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.
@MarcoGorelli Hi Marco, thanks for taking a look. Just gave it a run locally and I see this:
Traceback (most recent call last):
File "test_pickle.py", line 25, in
from pandas.compat import _get_lzma_file, _import_lzma, is_platform_little_endian
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/init.py", line 188, in
v = get_versions()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/_version.py", line 23, in get_versions
return json.loads(version_json)
AttributeError: module 'json' has no attribute 'loads'
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.
I don't see any errors related to the f-strings though..
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.
Sorry, just ran pytest and got this instead...
../../init.py:36: in
f"C extension: {module} not built. If you want to import "
E ImportError: C extension: No module named 'pandas._libs.tslibs.conversion' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force'
to build the C extensions first.
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.
For C extensions, see creating a development environment
Also, you need to run black
against any Python file you've modified, see contributing to the code base
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.
@MarcoGorelli Thanks! Will check those out 👍
thanks @drewseibert |
fixing some styling (using f-strings instead of .format)