Skip to content

Commit 48e55cc

Browse files
committed
fixup interval
1 parent e2b1941 commit 48e55cc

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

pandas/core/arrays/interval.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,16 @@ def _format_data(self):
832832

833833
return summary
834834

835+
def __repr__(self):
836+
tpl = textwrap.dedent("""\
837+
{cls}({data},
838+
{lead}closed='{closed}',
839+
{lead}dtype='{dtype}')""")
840+
return tpl.format(cls=self.__class__.__name__,
841+
data=self._format_data(),
842+
lead=' ' * len(self.__class__.__name__) + ' ',
843+
closed=self.closed, dtype=self.dtype)
844+
835845
def _format_space(self):
836846
space = ' ' * (len(self.__class__.__name__) + 1)
837847
return "\n{space}".format(space=space)

pandas/tests/extension/test_interval.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,6 @@ class TestSetitem(BaseInterval, base.BaseSetitemTests):
150150

151151

152152
class TestPrinting(BaseInterval, base.BasePrintingTests):
153-
pass
153+
@pytest.mark.skip(reason="custom repr")
154+
def test_array_repr(self, data, size):
155+
pass

0 commit comments

Comments
 (0)