6
6
from itertools import product
7
7
from distutils .version import LooseVersion
8
8
9
- import nose
10
- from nose .tools import assert_raises
9
+ import pytest
11
10
12
11
from numpy .random import randn , rand , randint
13
12
import numpy as np
@@ -319,7 +318,7 @@ def get_expected_pow_result(self, lhs, rhs):
319
318
except ValueError as e :
320
319
if str (e ).startswith ('negative number cannot be raised to a fractional power' ):
321
320
if self .engine == 'python' :
322
- raise nose . SkipTest (str (e ))
321
+ pytest . skip (str (e ))
323
322
else :
324
323
expected = np .nan
325
324
else :
@@ -1174,13 +1173,15 @@ def test_bool_ops_with_constants(self):
1174
1173
def test_panel_fails (self ):
1175
1174
x = Panel (randn (3 , 4 , 5 ))
1176
1175
y = Series (randn (10 ))
1177
- assert_raises (NotImplementedError , self .eval , 'x + y' ,
1176
+ with pytest .raises (NotImplementedError ):
1177
+ self .eval ('x + y' ,
1178
1178
local_dict = {'x' : x , 'y' : y })
1179
1179
1180
1180
def test_4d_ndarray_fails (self ):
1181
1181
x = randn (3 , 4 , 5 , 6 )
1182
1182
y = Series (randn (10 ))
1183
- assert_raises (NotImplementedError , self .eval , 'x + y' ,
1183
+ with pytest .raises (NotImplementedError ):
1184
+ self .eval ('x + y' ,
1184
1185
local_dict = {'x' : x , 'y' : y })
1185
1186
1186
1187
def test_constant (self ):
@@ -1705,7 +1706,7 @@ def test_result_types(self):
1705
1706
1706
1707
def test_result_types2 (self ):
1707
1708
# xref https://github.com/pandas-dev/pandas/issues/12293
1708
- raise nose . SkipTest ("unreliable tests on complex128" )
1709
+ pytest . skip ("unreliable tests on complex128" )
1709
1710
1710
1711
# Did not test complex64 because DataFrame is converting it to
1711
1712
# complex128. Due to https://github.com/pandas-dev/pandas/issues/10952
@@ -1822,7 +1823,8 @@ def check_disallowed_nodes(engine, parser):
1822
1823
inst = VisitorClass ('x + 1' , engine , parser )
1823
1824
1824
1825
for ops in uns_ops :
1825
- assert_raises (NotImplementedError , getattr (inst , ops ))
1826
+ with pytest .raises (NotImplementedError ):
1827
+ getattr (inst , ops )()
1826
1828
1827
1829
1828
1830
def test_disallowed_nodes ():
@@ -1833,7 +1835,8 @@ def test_disallowed_nodes():
1833
1835
def check_syntax_error_exprs (engine , parser ):
1834
1836
tm .skip_if_no_ne (engine )
1835
1837
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 )
1837
1840
1838
1841
1839
1842
def test_syntax_error_exprs ():
0 commit comments