@@ -677,58 +677,59 @@ def test_equals_op(self):
677677 tm .assert_numpy_array_equal (index_a  ==  item , expected3 )
678678 tm .assert_series_equal (series_a  ==  item , Series (expected3 ))
679679
680-  def  test_numpy_ufuncs (self ):
680+  def  test_numpy_ufuncs (self ,  indices ):
681681 # test ufuncs of numpy, see: 
682682 # http://docs.scipy.org/doc/numpy/reference/ufuncs.html 
683683
684-  for  name , idx  in  self .indices .items ():
685-  for  func  in  [np .exp , np .exp2 , np .expm1 , np .log , np .log2 , np .log10 ,
686-  np .log1p , np .sqrt , np .sin , np .cos , np .tan , np .arcsin ,
687-  np .arccos , np .arctan , np .sinh , np .cosh , np .tanh ,
688-  np .arcsinh , np .arccosh , np .arctanh , np .deg2rad ,
689-  np .rad2deg ]:
690-  if  isinstance (idx , DatetimeIndexOpsMixin ):
691-  # raise TypeError or ValueError (PeriodIndex) 
692-  # PeriodIndex behavior should be changed in future version 
684+  idx  =  indices 
685+  for  func  in  [np .exp , np .exp2 , np .expm1 , np .log , np .log2 , np .log10 ,
686+  np .log1p , np .sqrt , np .sin , np .cos , np .tan , np .arcsin ,
687+  np .arccos , np .arctan , np .sinh , np .cosh , np .tanh ,
688+  np .arcsinh , np .arccosh , np .arctanh , np .deg2rad ,
689+  np .rad2deg ]:
690+  if  isinstance (idx , DatetimeIndexOpsMixin ):
691+  # raise TypeError or ValueError (PeriodIndex) 
692+  # PeriodIndex behavior should be changed in future version 
693+  with  pytest .raises (Exception ):
694+  with  np .errstate (all = 'ignore' ):
695+  func (idx )
696+  elif  isinstance (idx , (Float64Index , Int64Index , UInt64Index )):
697+  # coerces to float (e.g. np.sin) 
698+  with  np .errstate (all = 'ignore' ):
699+  result  =  func (idx )
700+  exp  =  Index (func (idx .values ), name = idx .name )
701+ 
702+  tm .assert_index_equal (result , exp )
703+  assert  isinstance (result , pd .Float64Index )
704+  else :
705+  # raise AttributeError or TypeError 
706+  if  len (idx ) ==  0 :
707+  continue 
708+  else :
693709 with  pytest .raises (Exception ):
694710 with  np .errstate (all = 'ignore' ):
695711 func (idx )
696-  elif  isinstance (idx , (Float64Index , Int64Index , UInt64Index )):
697-  # coerces to float (e.g. np.sin) 
698-  with  np .errstate (all = 'ignore' ):
699-  result  =  func (idx )
700-  exp  =  Index (func (idx .values ), name = idx .name )
701712
702-  tm .assert_index_equal (result , exp )
703-  assert  isinstance (result , pd .Float64Index )
713+  for  func  in  [np .isfinite , np .isinf , np .isnan , np .signbit ]:
714+  if  isinstance (idx , DatetimeIndexOpsMixin ):
715+  # raise TypeError or ValueError (PeriodIndex) 
716+  with  pytest .raises (Exception ):
717+  func (idx )
718+  elif  isinstance (idx , (Float64Index , Int64Index , UInt64Index )):
719+  # Results in bool array 
720+  result  =  func (idx )
721+  assert  isinstance (result , np .ndarray )
722+  assert  not  isinstance (result , Index )
723+  else :
724+  if  len (idx ) ==  0 :
725+  continue 
704726 else :
705-  # raise AttributeError or TypeError 
706-  if  len (idx ) ==  0 :
707-  continue 
708-  else :
709-  with  pytest .raises (Exception ):
710-  with  np .errstate (all = 'ignore' ):
711-  func (idx )
712- 
713-  for  func  in  [np .isfinite , np .isinf , np .isnan , np .signbit ]:
714-  if  isinstance (idx , DatetimeIndexOpsMixin ):
715-  # raise TypeError or ValueError (PeriodIndex) 
716727 with  pytest .raises (Exception ):
717728 func (idx )
718-  elif  isinstance (idx , (Float64Index , Int64Index , UInt64Index )):
719-  # Results in bool array 
720-  result  =  func (idx )
721-  assert  isinstance (result , np .ndarray )
722-  assert  not  isinstance (result , Index )
723-  else :
724-  if  len (idx ) ==  0 :
725-  continue 
726-  else :
727-  with  pytest .raises (Exception ):
728-  func (idx )
729729
730730 def  test_hasnans_isnans (self ):
731731 # GH 11343, added tests for hasnans / isnans 
732+ 
732733 for  name , index  in  self .indices .items ():
733734 if  isinstance (index , MultiIndex ):
734735 pass 
0 commit comments