@@ -1922,6 +1922,33 @@ def test_promote_type(self):
1922
1922
self .assertEqual (index_promoted .dtype , np .float64 )
1923
1923
self .assertIsInstance (index_promoted , Float64Index )
1924
1924
1925
+ def test_promote_type_inplace (self ):
1926
+ # Related to GH-9966
1927
+ index = Int64Index (np .arange (5 ))
1928
+ index += np .pi
1929
+ self .assertEqual (index .dtype , np .float64 )
1930
+ self .assertIsInstance (index , Float64Index )
1931
+
1932
+ index = Int64Index (np .arange (5 ))
1933
+ index -= np .pi
1934
+ self .assertEqual (index .dtype , np .float64 )
1935
+ self .assertIsInstance (index , Float64Index )
1936
+
1937
+ index = Int64Index (np .arange (5 ))
1938
+ index *= np .pi
1939
+ self .assertEqual (index .dtype , np .float64 )
1940
+ self .assertIsInstance (index , Float64Index )
1941
+
1942
+ index = Int64Index (np .arange (5 ))
1943
+ index /= np .pi
1944
+ self .assertEqual (index .dtype , np .float64 )
1945
+ self .assertIsInstance (index , Float64Index )
1946
+
1947
+ index = Int64Index (np .arange (5 ))
1948
+ index //= np .pi
1949
+ self .assertEqual (index .dtype , np .float64 )
1950
+ self .assertIsInstance (index , Float64Index )
1951
+
1925
1952
def test_equals (self ):
1926
1953
1927
1954
i = Float64Index ([1.0 ,2.0 ])
0 commit comments