From 67e6cb0b9aaf3dca926f8369073a7a8fde2d7648 Mon Sep 17 00:00:00 2001 From: Pietro Battiston Date: Fri, 28 Jun 2019 22:01:21 +0200 Subject: [PATCH] TST: test initializing a Series from Index while passing dtype closes #17088 --- pandas/tests/series/test_constructors.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index f2345a0822f6d..49417942a3598 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -224,6 +224,13 @@ def test_constructor_list_like(self): result = Series(obj, index=[0, 1, 2]) assert_series_equal(result, expected) + @pytest.mark.parametrize('dtype', ['bool', 'int32', 'int64', 'float64']) + def test_constructor_index_dtype(self, dtype): + # GH 17088 + + s = Series(Index([0, 2, 4]), dtype=dtype) + assert s.dtype == dtype + @pytest.mark.parametrize('input_vals', [ ([1, 2]), (['1', '2']),