Skip to content

Commit

Permalink
Add note about SharedWithSparse._assert_series_equal()
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Jul 21, 2017
1 parent 0a7a362 commit b58cc06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pandas/tests/series/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@


class SharedWithSparse(object):
"""
A collection of tests Series and SparseSeries can share.
In generic tests on this class, use ``self._assert_series_equal()``
which is implemented in sub-classes.
"""
def _assert_series_equal(self, left, right):
"""Dispatch to series class dependent assertion"""
raise NotImplementedError
Expand Down Expand Up @@ -194,6 +199,7 @@ def test_constructor_dict_timedelta_index(self):
class TestSeriesMisc(TestData, SharedWithSparse):

series_klass = Series
# SharedWithSparse tests use generic, series_klass-agnostic assertion
_assert_series_equal = staticmethod(tm.assert_series_equal)

def test_tab_completion(self):
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/sparse/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def _test_data2_zero():
class TestSparseSeries(SharedWithSparse):

series_klass = SparseSeries
# SharedWithSparse tests use generic, series_klass-agnostic assertion
_assert_series_equal = staticmethod(tm.assert_sp_series_equal)

def setup_method(self, method):
Expand Down

0 comments on commit b58cc06

Please sign in to comment.