Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: array_view construction for empty arrays #5106

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

Merged
merged 8 commits into from
Oct 2, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
jkseppan committed Sep 27, 2015
commit 39658589d9bf352c05af9d9f05bf71fc17d10684
15 changes: 15 additions & 0 deletions lib/matplotlib/tests/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,21 @@ def test_nonsingular():
assert_array_equal(out, zero_expansion)


def test_invalid_arguments():
t = mtrans.Affine2D()
# There are two different exceptions, since the wrong number of
# dimensions is caught when constructing an array_view, and that
# raises a ValueError, and a wrong shape with a possible number
# of dimensions is caught by our CALL_CPP macro, which always
# raises the less precise RuntimeError.
assert_raises(ValueError, t.transform, 1)
assert_raises(ValueError, t.transform, [[[1]]])
assert_raises(RuntimeError, t.transform, [])
assert_raises(RuntimeError, t.transform, [1])
assert_raises(RuntimeError, t.transform, [[1]])
assert_raises(RuntimeError, t.transform, [[1, 2, 3]])


if __name__ == '__main__':
import nose
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)