From 966f50bf75f959c4e7103ce247ef04eae2a83782 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sat, 14 May 2016 17:05:26 -0400 Subject: [PATCH 1/4] TST: splitlines in rec2txt test On windows the output has '\r\n' instead of '\n' for new lines. --- lib/matplotlib/tests/test_mlab.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_mlab.py b/lib/matplotlib/tests/test_mlab.py index d34d1b79cf65..24f701abd539 100644 --- a/lib/matplotlib/tests/test_mlab.py +++ b/lib/matplotlib/tests/test_mlab.py @@ -405,8 +405,8 @@ def test_csv2txt_basic(self): (str('s2'), str, 4)])) truth = (' x y s s2\n' ' 1.000 2 foo bing \n' - ' 2.000 3 bar blah ') - assert_equal(mlab.rec2txt(a), truth) + ' 2.000 3 bar blah ').splitlines() + assert_equal(mlab.rec2txt(a).splitlines(), truth) class window_testcase(CleanupTestCase): From 1900372399315a345bd5cb32380af3bc00677886 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 16 May 2016 10:41:37 -0400 Subject: [PATCH 2/4] FIX: compute str column width The division was always returning 1, use length of first element instead. --- lib/matplotlib/mlab.py | 4 +--- lib/matplotlib/tests/test_mlab.py | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index a6e2d8e213fa..83dc2f59217e 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -3188,9 +3188,7 @@ def get_justify(colname, column, precision): ntype = column.dtype if np.issubdtype(ntype, str) or np.issubdtype(ntype, bytes): - # The division below handles unicode stored in array, which could - # have 4 bytes per char - length = max(len(colname), column.itemsize // column[0].itemsize) + length = max(len(colname), len(column[0])) return 0, length+padding, "%s" # left justify if np.issubdtype(ntype, np.int): diff --git a/lib/matplotlib/tests/test_mlab.py b/lib/matplotlib/tests/test_mlab.py index 24f701abd539..5eca224813c8 100644 --- a/lib/matplotlib/tests/test_mlab.py +++ b/lib/matplotlib/tests/test_mlab.py @@ -403,9 +403,9 @@ def test_csv2txt_basic(self): (str('y'), np.int8), (str('s'), str, 3), (str('s2'), str, 4)])) - truth = (' x y s s2\n' - ' 1.000 2 foo bing \n' - ' 2.000 3 bar blah ').splitlines() + truth = (' x y s s2\n' + ' 1.000 2 foo bing \n' + ' 2.000 3 bar blah ').splitlines() assert_equal(mlab.rec2txt(a).splitlines(), truth) From 0cb2c3a6c7e8640fde9d98fc7d6855d453f2f8b2 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 16 May 2016 20:49:12 -0400 Subject: [PATCH 3/4] CI: disable conda package building --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4183e0a74c78..32f6b4fde8e9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -89,6 +89,7 @@ test_script: - '%CMD_IN_ENV% python setup.py develop' # tests - python tests.py + # remove to get around libpng issue? - python visual_tests.py after_test: @@ -108,7 +109,7 @@ after_test: - cmd: path - cmd: where python - cmd: '%CMD_IN_ENV% conda config --get channels' - - cmd: '%CMD_IN_ENV% conda build .\ci\conda_recipe' + # - cmd: '%CMD_IN_ENV% conda build .\ci\conda_recipe' # Move the conda package into the dist directory, to register it # as an "artifact" for Appveyor. From 7765024215260b490fb8577c834c3ca557e11aea Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 16 May 2016 21:14:54 -0400 Subject: [PATCH 4/4] FIX: try more reliable way to get string length Fixed width byte/unicode dtypes seem to have the pattern "[|<>][US][1-9][0-9]*" thus if we drop the first two charters we will have the fixed width. --- lib/matplotlib/mlab.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index 83dc2f59217e..57fc4995f440 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -3188,7 +3188,8 @@ def get_justify(colname, column, precision): ntype = column.dtype if np.issubdtype(ntype, str) or np.issubdtype(ntype, bytes): - length = max(len(colname), len(column[0])) + fixed_width = int(ntype.str[2:]) + length = max(len(colname), fixed_width) return 0, length+padding, "%s" # left justify if np.issubdtype(ntype, np.int):