-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
FIX printing index with display.max_seq_items=None (GH10182) #10183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,14 @@ def test_str(self): | |
self.assertTrue("'foo'" in str(idx)) | ||
self.assertTrue(idx.__class__.__name__ in str(idx)) | ||
|
||
def test_repr_max_seq_item_setting(self): | ||
# GH10182 | ||
idx = self.create_index() | ||
idx = idx.repeat(50) | ||
with pd.option_context("display.max_seq_items", None): | ||
repr(idx) | ||
self.assertFalse('...' in str(idx)) | ||
|
||
def test_wrong_number_names(self): | ||
def testit(ind): | ||
ind.names = ["apple", "banana", "carrot"] | ||
|
@@ -2857,6 +2865,14 @@ def test_get_indexer(self): | |
with self.assertRaisesRegexp(ValueError, 'different freq'): | ||
idx.asfreq('D').get_indexer(idx) | ||
|
||
def test_repeat(self): | ||
# GH10183 | ||
idx = pd.period_range('2000-01-01', periods=3, freq='D') | ||
res = idx.repeat(3) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this as well to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. problem here is that I explicitly wanted to test the |
||
exp = PeriodIndex(idx.values.repeat(3), freq='D') | ||
self.assert_index_equal(res, exp) | ||
self.assertEqual(res.freqstr, 'D') | ||
|
||
|
||
class TestTimedeltaIndex(DatetimeLike, tm.TestCase): | ||
_holder = TimedeltaIndex | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to the
Base
class which tests for all sub-classesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is already in the Base class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, you know what the function above it is not testing much
test_str
(that's what I was looking at). should be iterating over theself.indices
rather than using.create_index()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not fully following the logic of the test set up.
self.indices
-> so iterating over these will run this test for all the different index typescreate_index
is also redefined in each subclass ofBase
, so in this way the test will also be run for the different index typesSo it seems two ways to achieve a bit the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.indices
has much more to test (and is customizable per sub-class), while.create_index
is a single plain vanilla one. For the generic tests using.indices
provides more coverage.