Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a special case for array scalars in YTArray.__str__ #1661

Merged
merged 3 commits into from Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion yt/units/tests/test_ytarray.py
Expand Up @@ -815,7 +815,8 @@ def unary_ufunc_comparison(ufunc, a):
elif ufunc is np.invert:
assert_raises(TypeError, ufunc, a)
elif hasattr(np, 'isnat') and ufunc is np.isnat:
assert_raises(ValueError, ufunc, a)
# numpy 1.13 raises ValueError, numpy 1.14 and newer raise TypeError
assert_raises((TypeError, ValueError), ufunc, a)
else:
# There shouldn't be any untested ufuncs.
assert_true(False)
Expand Down
2 changes: 1 addition & 1 deletion yt/units/yt_array.py
Expand Up @@ -529,7 +529,7 @@ def __str__(self):
"""

"""
return super(YTArray, self).__str__()+' '+self.units.__str__()
return str(self.view(np.ndarray)) + ' ' + str(self.units)

#
# Start unit conversion methods
Expand Down