Skip to content
Browse files

fixes bug #34

  • Loading branch information...
1 parent 92a6794 commit 26f548d0f65a26158c04714b96772af6ed13be92 @terhorst committed Jun 9, 2011
Showing with 14 additions and 3 deletions.
  1. +3 −3 datarray/print_grid.py
  2. +11 −0 datarray/tests/test_bugfixes.py
View
6 datarray/print_grid.py
@@ -273,8 +273,8 @@ def grid_layout(arr, width=75, height=10):
def labeled_layout(arr, width=75, height=10, row_label_width=9):
"""
Given a 2-D non-empty array that may have labeled axes, rows, or columns,
- render the array as strings to be joined and attach the axes in
- visually appropriate places.
+ render the array as strings to be joined and attach the axes in visually
+ appropriate places.
Returns a list of lists of strings to be joined.
"""
@@ -306,7 +306,7 @@ def labeled_layout(arr, width=75, height=10, row_label_width=9):
offset = 0
if arr.axes[1].labels: offset = 1
for r in xrange(cells_shown.shape[0]):
- layout[r+offset][0] = label_formatter.format(labels[r], row_label_width)
+ layout[r+offset][0] = label_formatter.format(str(labels[r]), row_label_width)
if row_header or col_header:
header0 = []
View
11 datarray/tests/test_bugfixes.py
@@ -48,6 +48,17 @@ def test_bug26():
a.axes[0].name = "a"
nt.assert_equal(a.axes[0].name, "a")
+def test_bug34():
+ "Bug 34: datetime.date ticks not handled by datarray_to_string"
+ from datarray.print_grid import datarray_to_string
+ from datetime import date as D
+ A = DataArray([[1,2],[3,4]], [('row', ('a', D(2010,1,1))),('col', 'cd')])
+ nt.assert_equal(datarray_to_string(A), """row col
+--------- -------------------
+ c d
+a 1 2
+2010-01-0 3 4""")
+
def test_bug35():
"Bug 35"
txt_array = DataArray(['a','b'], axes=['dummy'])

0 comments on commit 26f548d

Please sign in to comment.
Something went wrong with that request. Please try again.