Skip to content

Commit c2b5aad

Browse files
committed
assert_identical half way in ufuncs
1 parent db385da commit c2b5aad

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

xarray/tests/test_ufuncs.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
assert_equal)
1414

1515

16-
1716
class TestOps(TestCase):
18-
def assertIdentical(self, a, b):
17+
def assert_identical(self, a, b):
1918
assert type(a) is type(b) or (float(a) == float(b))
2019
try:
2120
assert a.identical(b), (a, b)
@@ -29,7 +28,7 @@ def test_unary(self):
2928
xr.DataArray([0, 0], dims='x'),
3029
xr.Dataset({'y': ('x', [0, 0])})]
3130
for a in args:
32-
self.assertIdentical(a + 1, xu.cos(a))
31+
self.assert_identical(a + 1, xu.cos(a))
3332

3433
def test_binary(self):
3534
args = [0,
@@ -39,10 +38,10 @@ def test_binary(self):
3938
xr.Dataset({'y': ('x', [0, 0])})]
4039
for n, t1 in enumerate(args):
4140
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))
4645

4746
def test_groupby(self):
4847
ds = xr.Dataset({'a': ('x', [0, 0, 0])}, {'c': ('x', [0, 0, 1])})
@@ -68,4 +67,4 @@ def test_groupby(self):
6867
def test_pickle(self):
6968
a = 1.0
7069
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

Comments
 (0)