Skip to content

Commit a15fee0

Browse files
committed
TST: Check for type promotion in numeric operations on indexes.
1 parent f100ebf commit a15fee0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/tests/test_index.py

+13
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,19 @@ def test_astype(self):
19091909
self.assertTrue(i.equals(result))
19101910
self.check_is_index(result)
19111911

1912+
def test_promote_type(self):
1913+
# GH-9966
1914+
index_int = Int64Index(np.arange(5))
1915+
operators = (operator.add,
1916+
operator.sub,
1917+
operator.mul,
1918+
operator.truediv,
1919+
operator.floordiv)
1920+
for op in operators:
1921+
index_promoted = op(index_int, np.pi)
1922+
self.assertEqual(index_promoted.dtype, np.float64)
1923+
self.assertIsInstance(index_promoted, Float64Index)
1924+
19121925
def test_equals(self):
19131926

19141927
i = Float64Index([1.0,2.0])

0 commit comments

Comments
 (0)