Skip to content

Commit

Permalink
ENH: Make representation match repr(itkVector)
Browse files Browse the repository at this point in the history
  • Loading branch information
HastingsGreer committed Oct 16, 2021
1 parent 152ed00 commit 5210cc2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Wrapping/Generators/Python/PyBase/pyBase.i
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ str = str
[vnl_mat.get(i, j) for j in range(vnl_mat.cols())]
for i in range(vnl_mat.rows())
]
return repr(type(self)).split("'")[1] + "(" + repr(python_list_mat) + ")"
return type(self).__name__ + " (" + repr(python_list_mat) + ")"
%}
}
Expand Down
2 changes: 1 addition & 1 deletion Wrapping/Generators/Python/Tests/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def custom_callback(name, progress):
# and make sure that the matrix hasn't changed.
assert m_itk(0, 0) == 1
# Test __repr__
assert repr(m_itk) == "itk.itkMatrixPython.itkMatrixD33([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])"
assert repr(m_itk) == "itkMatrixD33 ([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])"

# test .astype for itk.Image
numpyImage = np.random.randint(0, 256, (8, 12, 5)).astype(np.uint8)
Expand Down

0 comments on commit 5210cc2

Please sign in to comment.