Skip to content

Commit 09723ca

Browse files
committed
Merge pull request #7298 from matthew-brett/fix-dict-complex-failures
TST: fix intermittent dict_complex test failures
2 parents 150cb3b + 00bfcc1 commit 09723ca

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

pandas/io/tests/test_packers.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -149,21 +149,22 @@ def test_dict_float(self):
149149
def test_dict_complex(self):
150150
x = {'foo': 1.0 + 1.0j, 'bar': 2.0 + 2.0j}
151151
x_rec = self.encode_decode(x)
152-
self.assertTrue(all(map(lambda x, y: x == y, x.values(), x_rec.values())) and
153-
all(map(lambda x, y: type(x) == type(y), x.values(), x_rec.values())))
152+
self.assertEqual(x, x_rec)
153+
for key in x:
154+
self.assertEqual(type(x[key]), type(x_rec[key]))
154155

155156
def test_dict_numpy_float(self):
156157
x = {'foo': np.float32(1.0), 'bar': np.float32(2.0)}
157158
x_rec = self.encode_decode(x)
158159
tm.assert_almost_equal(x,x_rec)
159160

160161
def test_dict_numpy_complex(self):
161-
x = {'foo': np.complex128(
162-
1.0 + 1.0j), 'bar': np.complex128(2.0 + 2.0j)}
162+
x = {'foo': np.complex128(1.0 + 1.0j),
163+
'bar': np.complex128(2.0 + 2.0j)}
163164
x_rec = self.encode_decode(x)
164-
self.assertTrue(all(map(lambda x, y: x == y, x.values(), x_rec.values())) and
165-
all(map(lambda x, y: type(x) == type(y), x.values(), x_rec.values())))
166-
165+
self.assertEqual(x, x_rec)
166+
for key in x:
167+
self.assertEqual(type(x[key]), type(x_rec[key]))
167168

168169
def test_numpy_array_float(self):
169170

0 commit comments

Comments
 (0)