Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2842 from certik/backport459
Backport459
  • Loading branch information
rgommers committed Dec 17, 2012
2 parents 28aab32 + 049ae4d commit c4c169c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion numpy/core/arrayprint.py
Expand Up @@ -308,7 +308,7 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ',
elif issubclass(dtypeobj, _nt.datetime64):
format_function = formatdict['datetime']
else:
format_function = formatdict['str']
format_function = formatdict['numpystr']

# skip over "["
next_line_prefix = " "
Expand Down
11 changes: 11 additions & 0 deletions numpy/core/tests/test_arrayprint.py
@@ -1,3 +1,5 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import numpy as np
from numpy.testing import *
Expand Down Expand Up @@ -147,6 +149,15 @@ def test_formatter_reset(self):
np.set_printoptions(formatter={'float_kind':None})
assert_equal(repr(x), "array([ 0., 1., 2.])")

def test_unicode_object_array():
import sys
if sys.version_info[0] >= 3:
expected = "array(['é'], dtype=object)"
else:
expected = "array([u'\\xe9'], dtype=object)"
x = np.array([u'\xe9'], dtype=object)
assert_equal(repr(x), expected)



if __name__ == "__main__":
Expand Down

0 comments on commit c4c169c

Please sign in to comment.