There was an error while loading. Please reload this page.
1 parent 9cc32b0 commit a071304Copy full SHA for a071304
1 file changed
lib/matplotlib/tests/test_collections.py
@@ -1,5 +1,6 @@
1
import io
2
from types import SimpleNamespace
3
+from typing import Type
4
5
import numpy as np
6
from numpy.testing import assert_array_equal, assert_array_almost_equal
@@ -677,6 +678,22 @@ def test_collection_set_verts_array():
677
678
assert np.array_equal(ap._codes, atp._codes)
679
680
681
+def test_collection_set_array():
682
+ vals = [*range(10)]
683
+
684
+ # Test set_array with list
685
+ c = Collection()
686
+ c.set_array(vals)
687
688
+ # Test set_array with wrong dtype
689
+ with pytest.raises(TypeError, match="^Image data of dtype"):
690
+ c.set_array("wrong_input")
691
692
+ # Test if array kwarg is copied
693
+ vals[5] = 45
694
+ assert np.not_equal(vals, c.get_array()).any()
695
696
697
def test_blended_collection_autolim():
698
a = [1, 2, 4]
699
height = .2
0 commit comments