-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
CleanDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsTestingpandas testing functions or related to the test suitepandas testing functions or related to the test suite
Milestone
Description
Some new numeric dtype fixtures were implemented in #21432:
Lines 183 to 243 in 9e982e1
@pytest.fixture(params=["float32", "float64"]) | |
def float_dtype(request): | |
""" | |
Parameterized fixture for float dtypes. | |
* float32 | |
* float64 | |
""" | |
return request.param | |
UNSIGNED_INT_DTYPES = ["uint8", "uint16", "uint32", "uint64"] | |
SIGNED_INT_DTYPES = ["int8", "int16", "int32", "int64"] | |
ALL_INT_DTYPES = UNSIGNED_INT_DTYPES + SIGNED_INT_DTYPES | |
@pytest.fixture(params=SIGNED_INT_DTYPES) | |
def sint_dtype(request): | |
""" | |
Parameterized fixture for signed integer dtypes. | |
* int8 | |
* int16 | |
* int32 | |
* int64 | |
""" | |
return request.param | |
@pytest.fixture(params=UNSIGNED_INT_DTYPES) | |
def uint_dtype(request): | |
""" | |
Parameterized fixture for unsigned integer dtypes. | |
* uint8 | |
* uint16 | |
* uint32 | |
* uint64 | |
""" | |
return request.param | |
@pytest.fixture(params=ALL_INT_DTYPES) | |
def any_int_dtype(request): | |
""" | |
Parameterized fixture for any integer dtypes. | |
* int8 | |
* uint8 | |
* int16 | |
* uint16 | |
* int32 | |
* uint32 | |
* int64 | |
* uint64 | |
""" | |
return request.param |
It would be nice to use these fixtures where appropriate in the existing tests, e.g.
pandas/pandas/tests/indexes/datetimes/test_construction.py
Lines 527 to 528 in 9e982e1
@pytest.mark.parametrize('dtype', [np.int64, np.int32, np.int16, np.int8]) | |
def test_dti_constructor_small_int(self, dtype): |
Additional comments:
- These changes can be split across multiple PR's so no need to do all changes at once
- Not how many instances of this will need to be replaced, so this will need to be investigated
- This might involve expanding the dtype coverage for some tests
- The example test shown above could also be tested over uint dtypes
- Can probably drop
float16
dtypes from tests since it's barely supported - Might be necessary to create additional fixtures
- Perhaps a fixture for the combination of float + signed integer + unsigned integer dtypes
Metadata
Metadata
Assignees
Labels
CleanDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsTestingpandas testing functions or related to the test suitepandas testing functions or related to the test suite