Skip to content

Commit

Permalink
Merge pull request astropy#344 from jwoillez/issue_341
Browse files Browse the repository at this point in the history
Issue astropy#341: "RunTime error when printing astropy.table.Table row"
  • Loading branch information
taldcroft committed Aug 17, 2012
2 parents 59daf78 + 7318f8e commit 4a347ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion astropy/table/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def dtype(self):
return self.data.dtype

def __repr__(self):
return "<Row {0} of table\n values={1}\n dtype={2}>".format(
return "<Row {0} of table\n values={1!r}\n dtype={2}>".format(
self.index, self.data, self.dtype)


Expand Down
6 changes: 6 additions & 0 deletions astropy/table/tests/test_row.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,9 @@ def test_convert_numpy_array(self):

with pytest.raises(ValueError):
np_data = np.array(d, dtype=[('c', 'i8'), ('d', 'i8')])

def test_format_row(self):
"""Test formatting row"""
table = self.t
row = table[0]
assert format(row, "") == "<Row 0 of table\n values=(1, 4)\n dtype=[('a', '<i8'), ('b', '<i8')]>"

0 comments on commit 4a347ec

Please sign in to comment.