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

Skip to content

Commit 3965858

Browse files
committed
Add test
1 parent 536d175 commit 3965858

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/tests/test_transforms.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,21 @@ def test_nonsingular():
561561
assert_array_equal(out, zero_expansion)
562562

563563

564+
def test_invalid_arguments():
565+
t = mtrans.Affine2D()
566+
# There are two different exceptions, since the wrong number of
567+
# dimensions is caught when constructing an array_view, and that
568+
# raises a ValueError, and a wrong shape with a possible number
569+
# of dimensions is caught by our CALL_CPP macro, which always
570+
# raises the less precise RuntimeError.
571+
assert_raises(ValueError, t.transform, 1)
572+
assert_raises(ValueError, t.transform, [[[1]]])
573+
assert_raises(RuntimeError, t.transform, [])
574+
assert_raises(RuntimeError, t.transform, [1])
575+
assert_raises(RuntimeError, t.transform, [[1]])
576+
assert_raises(RuntimeError, t.transform, [[1, 2, 3]])
577+
578+
564579
if __name__ == '__main__':
565580
import nose
566581
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)