From 347fa13d3b2db0768bfc6877e34127db5446bd04 Mon Sep 17 00:00:00 2001 From: fotino21 Date: Fri, 10 Dec 2021 09:16:49 +0300 Subject: [PATCH 1/2] tests with fixture for dtypes added --- pandas/tests/dtypes/test_common.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index be5cb81506efd..f1ca59f084927 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -20,6 +20,7 @@ import pandas as pd import pandas._testing as tm +from pandas.api.types import pandas_dtype from pandas.arrays import SparseArray @@ -419,6 +420,23 @@ def test_is_not_int64_dtype(dtype): assert not com.is_int64_dtype(dtype) +def test_type_comparison_with_real_numpy_dtype(any_real_numpy_dtype): + # GH#43038 + assert pandas_dtype(any_real_numpy_dtype) == any_real_numpy_dtype + + +def test_type_comparison_with_numeric_ea_dtype(any_numeric_ea_dtype): + # GH#43038 + assert pandas_dtype(any_numeric_ea_dtype) == any_numeric_ea_dtype + + +def test_type_comparison_with_signed_int_ea_dtype_and_signed_int_numpy_dtype( + any_signed_int_ea_dtype, any_signed_int_numpy_dtype +): + # GH#43038 + assert not pandas_dtype(any_signed_int_ea_dtype) == any_signed_int_numpy_dtype + + def test_is_datetime64_any_dtype(): assert not com.is_datetime64_any_dtype(int) assert not com.is_datetime64_any_dtype(str) From f0288e9d7a1fd0affb2f91827ad0b4e07e1a5024 Mon Sep 17 00:00:00 2001 From: fotino21 Date: Fri, 10 Dec 2021 11:37:58 +0300 Subject: [PATCH 2/2] tests added for dtype comparison with fixture --- pandas/tests/dtypes/test_common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index f1ca59f084927..fb86ad63b9ed8 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -420,14 +420,14 @@ def test_is_not_int64_dtype(dtype): assert not com.is_int64_dtype(dtype) -def test_type_comparison_with_real_numpy_dtype(any_real_numpy_dtype): +def test_type_comparison_with_numeric_ea_dtype(any_numeric_ea_dtype): # GH#43038 - assert pandas_dtype(any_real_numpy_dtype) == any_real_numpy_dtype + assert pandas_dtype(any_numeric_ea_dtype) == any_numeric_ea_dtype -def test_type_comparison_with_numeric_ea_dtype(any_numeric_ea_dtype): +def test_type_comparison_with_real_numpy_dtype(any_real_numpy_dtype): # GH#43038 - assert pandas_dtype(any_numeric_ea_dtype) == any_numeric_ea_dtype + assert pandas_dtype(any_real_numpy_dtype) == any_real_numpy_dtype def test_type_comparison_with_signed_int_ea_dtype_and_signed_int_numpy_dtype(