66from itertools import product
77from distutils .version import LooseVersion
88
9- import nose
10- from nose .tools import assert_raises
9+ import pytest
1110
1211from numpy .random import randn , rand , randint
1312import numpy as np
@@ -319,7 +318,7 @@ def get_expected_pow_result(self, lhs, rhs):
319318 except ValueError as e :
320319 if str (e ).startswith ('negative number cannot be raised to a fractional power' ):
321320 if self .engine == 'python' :
322- raise nose . SkipTest (str (e ))
321+ pytest . skip (str (e ))
323322 else :
324323 expected = np .nan
325324 else :
@@ -1174,13 +1173,15 @@ def test_bool_ops_with_constants(self):
11741173 def test_panel_fails (self ):
11751174 x = Panel (randn (3 , 4 , 5 ))
11761175 y = Series (randn (10 ))
1177- assert_raises (NotImplementedError , self .eval , 'x + y' ,
1176+ with pytest .raise (NotImplementedError ):
1177+ self .eval ('x + y' ,
11781178 local_dict = {'x' : x , 'y' : y })
11791179
11801180 def test_4d_ndarray_fails (self ):
11811181 x = randn (3 , 4 , 5 , 6 )
11821182 y = Series (randn (10 ))
1183- assert_raises (NotImplementedError , self .eval , 'x + y' ,
1183+ with pytest .raises (NotImplementedError ):
1184+ self .eval ('x + y' ,
11841185 local_dict = {'x' : x , 'y' : y })
11851186
11861187 def test_constant (self ):
@@ -1705,7 +1706,7 @@ def test_result_types(self):
17051706
17061707 def test_result_types2 (self ):
17071708 # xref https://github.com/pandas-dev/pandas/issues/12293
1708- raise nose . SkipTest ("unreliable tests on complex128" )
1709+ pytest . skip ("unreliable tests on complex128" )
17091710
17101711 # Did not test complex64 because DataFrame is converting it to
17111712 # complex128. Due to https://github.com/pandas-dev/pandas/issues/10952
@@ -1822,7 +1823,8 @@ def check_disallowed_nodes(engine, parser):
18221823 inst = VisitorClass ('x + 1' , engine , parser )
18231824
18241825 for ops in uns_ops :
1825- assert_raises (NotImplementedError , getattr (inst , ops ))
1826+ with pytest .raises (NotImplementedError ):
1827+ getattr (inst , ops )
18261828
18271829
18281830def test_disallowed_nodes ():
@@ -1833,7 +1835,8 @@ def test_disallowed_nodes():
18331835def check_syntax_error_exprs (engine , parser ):
18341836 tm .skip_if_no_ne (engine )
18351837 e = 's +'
1836- assert_raises (SyntaxError , pd .eval , e , engine = engine , parser = parser )
1838+ with pytest .raises (SyntaxError ):
1839+ pd .eval (e , engine = engine , parser = parser )
18371840
18381841
18391842def test_syntax_error_exprs ():
0 commit comments