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 1
1
import io
2
2
from types import SimpleNamespace
3
+ from typing import Type
3
4
4
5
import numpy as np
5
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 )
678
679
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
+
680
697
def test_blended_collection_autolim ():
681
698
a = [1 , 2 , 4 ]
682
699
height = .2
You can’t perform that action at this time.
0 commit comments