-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
STYLE pre-commit check to ensure that test functions name starts with test #50397
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
STYLE pre-commit check to ensure that test functions name starts with test #50397
Conversation
18bd5f4
to
e13b5a8
Compare
@@ -113,10 +113,11 @@ def test_read_columns(self): | |||
columns = ["col1", "col3"] | |||
self.check_round_trip(df, expected=df[columns], columns=columns) | |||
|
|||
def read_columns_different_order(self): | |||
def test_read_columns_different_order(self): |
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.
@alimcmaster1 this test was never running because its name didn't start with test_
(just FYI, no blame!)
@@ -1323,10 +1323,6 @@ def test_period_can_hold_element(self, element): | |||
elem = element(dti) | |||
self.check_series_setitem(elem, pi, False) | |||
|
|||
def check_setting(self, elem, index: Index, inplace: bool): |
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.
helper function which wasn't being used anymore
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.
@jbrockmendel looks like it was added in https://github.com/pandas-dev/pandas/pull/39120/files - do you remember if it was meant to be used anywhere?
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.
Looks like it was meant to de-duplicate something but never got used. Rip it out!
@@ -1350,23 +1346,6 @@ def check_series_setitem(self, elem, index: Index, inplace: bool): | |||
else: | |||
assert ser.dtype == object | |||
|
|||
def check_frame_setitem(self, elem, index: Index, inplace: bool): |
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.
helper function which wasn't being used anymore
@@ -11,7 +11,13 @@ | |||
_testing as tm, | |||
concat, | |||
) | |||
from pandas.tests.strings.test_strings import assert_series_or_index_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.
this function was defined in another file, but only used here. so, just moving it here
@@ -30,13 +30,18 @@ | |||
YearEnd, | |||
) | |||
|
|||
from pandas.tests.tseries.offsets.test_offsets import get_utc_offset_hours |
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.
defined in another file, but only used here. so, let's just define it here
^pandas/tests/generic/test_generic.py # GH50380 | ||
|^pandas/tests/io/json/test_readlines.py # GH50378 |
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.
these exclusions will be removed as they're addressed
7d2cce3
to
30277d2
Compare
scripts/check_test_naming.py
Outdated
and names.count(node.name) == 0 | ||
and not any(_is_fixture(decorator) for decorator in node.decorator_list) | ||
and PRAGMA not in line | ||
and not node.name.startswith("_") |
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 guess there could be a function called def _test_thing
was was meant to be a test but maybe it's not worth worrying about?
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.
good point actually - the three functions which this check found which started with underscores looked like helper functions, but were all unused. So, let's just remove them
02ed082
to
15bcf4d
Compare
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.
Nice! LGTM
Just for the record - my hope is that we can eventually get to 100% coverage, and that then this tool wouldn't be necessary But in the meantime, it takes ~3 seconds to run on CI, and can help identify issues |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.