Skip to content

Commit a6b1a22

Browse files
committed
TST: sparse display repr on windows, xref #12779
1 parent c2a481f commit a6b1a22

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pandas/tests/test_format.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from distutils.version import LooseVersion
88
import re
99

10-
from pandas.compat import range, zip, lrange, StringIO, PY3, lzip, u
10+
from pandas.compat import (range, zip, lrange, StringIO, PY3,
11+
u, lzip, is_platform_windows)
1112
import pandas.compat as compat
1213
import itertools
1314
from operator import methodcaller
@@ -3714,19 +3715,20 @@ def test_to_string_header(self):
37143715
def test_sparse_max_row(self):
37153716
s = pd.Series([1, np.nan, np.nan, 3, np.nan]).to_sparse()
37163717
result = repr(s)
3718+
dtype = '' if is_platform_windows() else ', dtype=int32'
37173719
exp = ("0 1.0\n1 NaN\n2 NaN\n3 3.0\n"
37183720
"4 NaN\ndtype: float64\nBlockIndex\n"
3719-
"Block locations: array([0, 3], dtype=int32)\n"
3720-
"Block lengths: array([1, 1], dtype=int32)")
3721+
"Block locations: array([0, 3]{0})\n"
3722+
"Block lengths: array([1, 1]{0})".format(dtype))
37213723
self.assertEqual(result, exp)
37223724

37233725
with option_context("display.max_rows", 3):
37243726
# GH 10560
37253727
result = repr(s)
37263728
exp = ("0 1.0\n ... \n4 NaN\n"
37273729
"dtype: float64\nBlockIndex\n"
3728-
"Block locations: array([0, 3], dtype=int32)\n"
3729-
"Block lengths: array([1, 1], dtype=int32)")
3730+
"Block locations: array([0, 3]{0})\n"
3731+
"Block lengths: array([1, 1]{0})".format(dtype))
37303732
self.assertEqual(result, exp)
37313733

37323734

0 commit comments

Comments
 (0)