Skip to content

Commit 7364e2b

Browse files
committed
test_hash_pandas_object
1 parent 8ec8d9b commit 7364e2b

File tree

1 file changed

+27
-31
lines changed

1 file changed

+27
-31
lines changed

pandas/tests/util/test_hashing.py

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -142,37 +142,33 @@ def test_multiindex_objects(self):
142142
tm.assert_numpy_array_equal(np.sort(result),
143143
np.sort(expected))
144144

145-
def test_hash_pandas_object(self):
146-
147-
for obj in [Series([1, 2, 3]),
148-
Series([1.0, 1.5, 3.2]),
149-
Series([1.0, 1.5, np.nan]),
150-
Series([1.0, 1.5, 3.2], index=[1.5, 1.1, 3.3]),
151-
Series(['a', 'b', 'c']),
152-
Series(['a', np.nan, 'c']),
153-
Series(['a', None, 'c']),
154-
Series([True, False, True]),
155-
Series(),
156-
Index([1, 2, 3]),
157-
Index([True, False, True]),
158-
DataFrame({'x': ['a', 'b', 'c'], 'y': [1, 2, 3]}),
159-
DataFrame(),
160-
tm.makeMissingDataframe(),
161-
tm.makeMixedDataFrame(),
162-
tm.makeTimeDataFrame(),
163-
tm.makeTimeSeries(),
164-
tm.makeTimedeltaIndex(),
165-
tm.makePeriodIndex(),
166-
Series(tm.makePeriodIndex()),
167-
Series(pd.date_range('20130101',
168-
periods=3, tz='US/Eastern')),
169-
MultiIndex.from_product(
170-
[range(5),
171-
['foo', 'bar', 'baz'],
172-
pd.date_range('20130101', periods=2)]),
173-
MultiIndex.from_product(
174-
[pd.CategoricalIndex(list('aabc')),
175-
range(3)])]:
145+
@pytest.mark.parametrize('obj', [
146+
Series([1, 2, 3]),
147+
Series([1.0, 1.5, 3.2]),
148+
Series([1.0, 1.5, np.nan]),
149+
Series([1.0, 1.5, 3.2], index=[1.5, 1.1, 3.3]),
150+
Series(['a', 'b', 'c']),
151+
Series(['a', np.nan, 'c']),
152+
Series(['a', None, 'c']),
153+
Series([True, False, True]),
154+
Series(),
155+
Index([1, 2, 3]),
156+
Index([True, False, True]),
157+
DataFrame({'x': ['a', 'b', 'c'], 'y': [1, 2, 3]}),
158+
DataFrame(),
159+
tm.makeMissingDataframe(),
160+
tm.makeMixedDataFrame(),
161+
tm.makeTimeDataFrame(),
162+
tm.makeTimeSeries(),
163+
tm.makeTimedeltaIndex(),
164+
tm.makePeriodIndex(),
165+
Series(tm.makePeriodIndex()),
166+
Series(pd.date_range('20130101', periods=3, tz='US/Eastern')),
167+
MultiIndex.from_product([range(5), ['foo', 'bar', 'baz'],
168+
pd.date_range('20130101', periods=2)]),
169+
MultiIndex.from_product([pd.CategoricalIndex(list('aabc')), range(3)])
170+
])
171+
def test_hash_pandas_object(self, obj):
176172
self.check_equal(obj)
177173
self.check_not_equal_with_index(obj)
178174

0 commit comments

Comments
 (0)