Skip to content

Commit 9bcfd76

Browse files
fix categorical and sparse tests
1 parent 02dc7d0 commit 9bcfd76

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pandas/tests/sparse/test_format.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_sparse_max_row(self):
3333
# GH 10560
3434
result = repr(s)
3535
exp = ("0 1.0\n ... \n4 NaN\n"
36-
"dtype: float64\nBlockIndex\n"
36+
"Length: 5, dtype: float64\nBlockIndex\n"
3737
"Block locations: array([0, 3]{0})\n"
3838
"Block lengths: array([1, 1]{0})".format(dfm))
3939
self.assertEqual(result, exp)
@@ -52,7 +52,8 @@ def test_sparse_mi_max_row(self):
5252
"Block lengths: array([1, 1]{0})".format(dfm))
5353
self.assertEqual(result, exp)
5454

55-
with option_context("display.max_rows", 3):
55+
with option_context("display.max_rows", 3,
56+
"display.show_dimensions", False):
5657
# GH 13144
5758
result = repr(s)
5859
exp = ("A 0 1.0\n ... \nC 2 NaN\n"
@@ -77,7 +78,7 @@ def test_sparse_bool(self):
7778
with option_context("display.max_rows", 3):
7879
result = repr(s)
7980
exp = ("0 True\n ... \n5 False\n"
80-
"dtype: bool\nBlockIndex\n"
81+
"Length: 6, dtype: bool\nBlockIndex\n"
8182
"Block locations: array([0, 3]{0})\n"
8283
"Block lengths: array([1, 1]{0})".format(dtype))
8384
self.assertEqual(result, exp)
@@ -94,7 +95,8 @@ def test_sparse_int(self):
9495
"Block lengths: array([1, 1]{0})".format(dtype))
9596
self.assertEqual(result, exp)
9697

97-
with option_context("display.max_rows", 3):
98+
with option_context("display.max_rows", 3,
99+
"display.show_dimensions", False):
98100
result = repr(s)
99101
exp = ("0 0\n ..\n5 0\n"
100102
"dtype: int64\nBlockIndex\n"

pandas/tests/test_categorical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2088,7 +2088,7 @@ def test_repr(self):
20882088

20892089
a = pd.Series(pd.Categorical(["a", "b"] * 25))
20902090
exp = u("0 a\n1 b\n" + " ..\n" + "48 a\n49 b\n" +
2091-
"dtype: category\nCategories (2, object): [a, b]")
2091+
"Length: 50, dtype: category\nCategories (2, object): [a, b]")
20922092
with option_context("display.max_rows", 5):
20932093
self.assertEqual(exp, repr(a))
20942094

0 commit comments

Comments
 (0)