-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: Parametrize dtypes tests - test_common.py and test_concat.py #20340
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
object, 'float64', np.object_, np.dtype('object'), 'O', | ||
np.float64, float, np.dtype('float64')]) | ||
def test_pandas_dtype_valid(self, dtype): | ||
assert com.pandas_dtype(dtype) == dtype |
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.
Not sure this test is actually necessary? Split this off from the test_invalid_dtype_error
, as it appears to be testing valid instead of invalid dtypes. Previously this didn't have any type of assert
statement; it just called pandas_dtype
and the test passed if no error was raised.
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.
yeah this is ok, this is just testing that pandas_dtype doesn't raise on numpy dtypes
pandas/tests/dtypes/test_common.py
Outdated
valid_list = [object, 'float64', np.object_, np.dtype('object'), 'O', | ||
np.float64, float, np.dtype('float64')] | ||
for dtype in valid_list: | ||
@pytest.mark.parametrize('dtype', [pd.Timestamp, 'pd.Timestamp', list]) |
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.
can you call this box
object, 'float64', np.object_, np.dtype('object'), 'O', | ||
np.float64, float, np.dtype('float64')]) | ||
def test_pandas_dtype_valid(self, dtype): | ||
assert com.pandas_dtype(dtype) == dtype |
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.
yeah this is ok, this is just testing that pandas_dtype doesn't raise on numpy dtypes
pandas/tests/dtypes/test_concat.py
Outdated
Index, DatetimeIndex, PeriodIndex, TimedeltaIndex, Series, Period) | ||
|
||
|
||
# test cases of the form (to_concat, expected) |
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.
can you make these fixtures? (or just put directly into the parameterize itself)
pandas/tests/dtypes/test_concat.py
Outdated
assert result == set(expected) | ||
|
||
|
||
# test cases of the form (to_concat, expected) |
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.
same
Codecov Report
@@ Coverage Diff @@
## master #20340 +/- ##
==========================================
- Coverage 91.76% 91.73% -0.03%
==========================================
Files 150 150
Lines 49151 49151
==========================================
- Hits 45102 45090 -12
- Misses 4049 4061 +12
Continue to review full report at Codecov.
|
made the requested changes |
thanks @jschendel |
Parametrized some straightforward dtypes related tests.
Relatively minor changes to
test_common.py
:for
loopsMade larger changes to
test_concat.py
:check_concat
validation function since it's only called once nowfor
loop previously in thecheck_concat
validation functionimport pandas as pd
in favor of directly importing the necessary classes