diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index 290cdd732b6d69..b02691e9573669 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -568,3 +568,40 @@ def test__get_dtype(input_param, result): def test__get_dtype_fails(input_param): # python objects pytest.raises(TypeError, com._get_dtype, input_param) + + +@pytest.mark.parametrize('input_param,result', [ + (int, np.dtype(int).type), + ('int32', np.int32), + (float, np.dtype(float).type), + ('float64', np.float64), + (np.dtype('float64'), np.float64), + (str, np.dtype(str).type), + (pd.Series([1, 2], dtype=np.dtype('int16')), np.int16), + (pd.Series(['a', 'b']), np.object_), + (pd.Index([1, 2], dtype='int64'), np.int64), + (pd.Index(['a', 'b']), np.object_), + ('category', com.CategoricalDtypeType), + (pd.Categorical(['a', 'b']).dtype, com.CategoricalDtypeType), + (pd.Categorical(['a', 'b']), com.CategoricalDtypeType), + (pd.CategoricalIndex(['a', 'b']).dtype, com.CategoricalDtypeType), + (pd.CategoricalIndex(['a', 'b']), com.CategoricalDtypeType), + (pd.DatetimeIndex([1, 2]), np.datetime64), + (pd.DatetimeIndex([1, 2]).dtype, np.datetime64), + ('