Skip to content

Commit

Permalink
fixes bug BIDS#34
Browse files Browse the repository at this point in the history
  • Loading branch information
terhorst committed Jun 9, 2011
1 parent 92a6794 commit 26f548d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions datarray/print_grid.py
Expand Up @@ -273,8 +273,8 @@ def grid_layout(arr, width=75, height=10):
def labeled_layout(arr, width=75, height=10, row_label_width=9): 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, 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 render the array as strings to be joined and attach the axes in visually
visually appropriate places. appropriate places.
Returns a list of lists of strings to be joined. Returns a list of lists of strings to be joined.
""" """
Expand Down Expand Up @@ -306,7 +306,7 @@ def labeled_layout(arr, width=75, height=10, row_label_width=9):
offset = 0 offset = 0
if arr.axes[1].labels: offset = 1 if arr.axes[1].labels: offset = 1
for r in xrange(cells_shown.shape[0]): 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: if row_header or col_header:
header0 = [] header0 = []
Expand Down
11 changes: 11 additions & 0 deletions datarray/tests/test_bugfixes.py
Expand Up @@ -48,6 +48,17 @@ def test_bug26():
a.axes[0].name = "a" a.axes[0].name = "a"
nt.assert_equal(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(): def test_bug35():
"Bug 35" "Bug 35"
txt_array = DataArray(['a','b'], axes=['dummy']) txt_array = DataArray(['a','b'], axes=['dummy'])
Expand Down

0 comments on commit 26f548d

Please sign in to comment.