13
13
assert_equal )
14
14
15
15
16
-
17
16
class TestOps (TestCase ):
18
- def assertIdentical (self , a , b ):
17
+ def assert_identical (self , a , b ):
19
18
assert type (a ) is type (b ) or (float (a ) == float (b ))
20
19
try :
21
20
assert a .identical (b ), (a , b )
@@ -29,7 +28,7 @@ def test_unary(self):
29
28
xr .DataArray ([0 , 0 ], dims = 'x' ),
30
29
xr .Dataset ({'y' : ('x' , [0 , 0 ])})]
31
30
for a in args :
32
- self .assertIdentical (a + 1 , xu .cos (a ))
31
+ self .assert_identical (a + 1 , xu .cos (a ))
33
32
34
33
def test_binary (self ):
35
34
args = [0 ,
@@ -39,10 +38,10 @@ def test_binary(self):
39
38
xr .Dataset ({'y' : ('x' , [0 , 0 ])})]
40
39
for n , t1 in enumerate (args ):
41
40
for t2 in args [n :]:
42
- self .assertIdentical (t2 + 1 , xu .maximum (t1 , t2 + 1 ))
43
- self .assertIdentical (t2 + 1 , xu .maximum (t2 , t1 + 1 ))
44
- self .assertIdentical (t2 + 1 , xu .maximum (t1 + 1 , t2 ))
45
- self .assertIdentical (t2 + 1 , xu .maximum (t2 + 1 , t1 ))
41
+ self .assert_identical (t2 + 1 , xu .maximum (t1 , t2 + 1 ))
42
+ self .assert_identical (t2 + 1 , xu .maximum (t2 , t1 + 1 ))
43
+ self .assert_identical (t2 + 1 , xu .maximum (t1 + 1 , t2 ))
44
+ self .assert_identical (t2 + 1 , xu .maximum (t2 + 1 , t1 ))
46
45
47
46
def test_groupby (self ):
48
47
ds = xr .Dataset ({'a' : ('x' , [0 , 0 , 0 ])}, {'c' : ('x' , [0 , 0 , 1 ])})
@@ -68,4 +67,4 @@ def test_groupby(self):
68
67
def test_pickle (self ):
69
68
a = 1.0
70
69
cos_pickled = pickle .loads (pickle .dumps (xu .cos ))
71
- self .assertIdentical (cos_pickled (a ), xu .cos (a ))
70
+ self .assert_identical (cos_pickled (a ), xu .cos (a ))
0 commit comments