File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11import io
22from types import SimpleNamespace
3+ from typing import Type
34
45import numpy as np
56from numpy .testing import assert_array_equal , assert_array_almost_equal
@@ -677,6 +678,22 @@ def test_collection_set_verts_array():
677678 assert np .array_equal (ap ._codes , atp ._codes )
678679
679680
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+
680697def test_blended_collection_autolim ():
681698 a = [1 , 2 , 4 ]
682699 height = .2
You can’t perform that action at this time.
0 commit comments