@@ -1542,66 +1542,6 @@ def test_shift_categorical(self):
15421542 assert_index_equal (s .values .categories , sp1 .values .categories )
15431543 assert_index_equal (s .values .categories , sn2 .values .categories )
15441544
1545- def test_reshape_deprecate (self ):
1546- x = Series (np .random .random (10 ), name = 'x' )
1547- tm .assert_produces_warning (FutureWarning , x .reshape , x .shape )
1548-
1549- def test_reshape_non_2d (self ):
1550- # see gh-4554
1551- with tm .assert_produces_warning (FutureWarning ):
1552- x = Series (np .random .random (201 ), name = 'x' )
1553- assert x .reshape (x .shape , ) is x
1554-
1555- # see gh-2719
1556- with tm .assert_produces_warning (FutureWarning ):
1557- a = Series ([1 , 2 , 3 , 4 ])
1558- result = a .reshape (2 , 2 )
1559- expected = a .values .reshape (2 , 2 )
1560- tm .assert_numpy_array_equal (result , expected )
1561- assert isinstance (result , type (expected ))
1562-
1563- def test_reshape_2d_return_array (self ):
1564- x = Series (np .random .random (201 ), name = 'x' )
1565-
1566- with tm .assert_produces_warning (FutureWarning ):
1567- result = x .reshape ((- 1 , 1 ))
1568- assert not isinstance (result , Series )
1569-
1570- with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
1571- result2 = np .reshape (x , (- 1 , 1 ))
1572- assert not isinstance (result2 , Series )
1573-
1574- with tm .assert_produces_warning (FutureWarning ):
1575- result = x [:, None ]
1576- expected = x .reshape ((- 1 , 1 ))
1577- tm .assert_almost_equal (result , expected )
1578-
1579- def test_reshape_bad_kwarg (self ):
1580- a = Series ([1 , 2 , 3 , 4 ])
1581-
1582- with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
1583- msg = "'foo' is an invalid keyword argument for this function"
1584- tm .assert_raises_regex (
1585- TypeError , msg , a .reshape , (2 , 2 ), foo = 2 )
1586-
1587- with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
1588- msg = r"reshape\(\) got an unexpected keyword argument 'foo'"
1589- tm .assert_raises_regex (
1590- TypeError , msg , a .reshape , a .shape , foo = 2 )
1591-
1592- def test_numpy_reshape (self ):
1593- a = Series ([1 , 2 , 3 , 4 ])
1594-
1595- with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
1596- result = np .reshape (a , (2 , 2 ))
1597- expected = a .values .reshape (2 , 2 )
1598- tm .assert_numpy_array_equal (result , expected )
1599- assert isinstance (result , type (expected ))
1600-
1601- with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
1602- result = np .reshape (a , a .shape )
1603- tm .assert_series_equal (result , a )
1604-
16051545 def test_unstack (self ):
16061546 from numpy import nan
16071547
0 commit comments