Skip to content
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

TST: Use numeric dtype fixtures for testing #21500

Closed
jschendel opened this issue Jun 15, 2018 · 1 comment
Closed

TST: Use numeric dtype fixtures for testing #21500

jschendel opened this issue Jun 15, 2018 · 1 comment
Labels
Clean Dtype Conversions Unexpected or buggy dtype conversions Testing pandas testing functions or related to the test suite
Milestone

Comments

@jschendel
Copy link
Member

Some new numeric dtype fixtures were implemented in #21432:

pandas/pandas/conftest.py

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.

@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
@jschendel jschendel added Testing pandas testing functions or related to the test suite Dtype Conversions Unexpected or buggy dtype conversions Effort Medium Clean labels Jun 15, 2018
gfyoung added a commit to forking-repos/pandas that referenced this issue Jun 22, 2018
gfyoung added a commit to forking-repos/pandas that referenced this issue Jun 22, 2018
jreback pushed a commit that referenced this issue Jun 22, 2018
@gfyoung gfyoung added this to the 0.24.0 milestone Jul 26, 2018
@gfyoung
Copy link
Member

gfyoung commented Jul 26, 2018

They have propagated since this issue was opened. Just need to make sure we use them in new PR's.

@gfyoung gfyoung closed this as completed Jul 26, 2018
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this issue Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Dtype Conversions Unexpected or buggy dtype conversions Testing pandas testing functions or related to the test suite
Projects
None yet
Development

No branches or pull requests

2 participants