Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cab8cf7

Browse files
jenshnielsentacaswell
authored andcommitted
Merge pull request #6423 from tacaswell/tst_fix_windows_print_test
TST: splitlines in rec2txt test
1 parent 2fa27af commit cab8cf7

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lib/matplotlib/mlab.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3188,9 +3188,8 @@ def get_justify(colname, column, precision):
31883188
ntype = column.dtype
31893189

31903190
if np.issubdtype(ntype, str) or np.issubdtype(ntype, bytes):
3191-
# The division below handles unicode stored in array, which could
3192-
# have 4 bytes per char
3193-
length = max(len(colname), column.itemsize // column[0].itemsize)
3191+
fixed_width = int(ntype.str[2:])
3192+
length = max(len(colname), fixed_width)
31943193
return 0, length+padding, "%s" # left justify
31953194

31963195
if np.issubdtype(ntype, np.int):

lib/matplotlib/tests/test_mlab.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,10 @@ def test_csv2txt_basic(self):
403403
(str('y'), np.int8),
404404
(str('s'), str, 3),
405405
(str('s2'), str, 4)]))
406-
truth = (' x y s s2\n'
407-
' 1.000 2 foo bing \n'
408-
' 2.000 3 bar blah ')
409-
assert_equal(mlab.rec2txt(a), truth)
406+
truth = (' x y s s2\n'
407+
' 1.000 2 foo bing \n'
408+
' 2.000 3 bar blah ').splitlines()
409+
assert_equal(mlab.rec2txt(a).splitlines(), truth)
410410

411411

412412
class window_testcase(CleanupTestCase):

0 commit comments

Comments
 (0)