8
8
from pygmt import Figure
9
9
from pygmt .exceptions import GMTCLibError , GMTInvalidInput
10
10
from pygmt .helpers import GMTTempFile
11
+ from pygmt .helpers .testing import skip_if_no
12
+
13
+ try :
14
+ import pyarrow as pa
15
+ except ImportError :
16
+ pa = None
11
17
12
18
TEST_DATA_DIR = os .path .join (os .path .dirname (__file__ ), "data" )
13
19
POINTS_DATA = os .path .join (TEST_DATA_DIR , "points.txt" )
@@ -47,8 +53,20 @@ def test_text_single_line_of_text(region, projection):
47
53
48
54
49
55
@pytest .mark .benchmark
50
- @pytest .mark .mpl_image_compare
51
- def test_text_multiple_lines_of_text (region , projection ):
56
+ @pytest .mark .mpl_image_compare (filename = "test_text_multiple_lines_of_text.png" )
57
+ @pytest .mark .parametrize (
58
+ "array_func" ,
59
+ [
60
+ list ,
61
+ pytest .param (np .array , id = "numpy" ),
62
+ pytest .param (
63
+ getattr (pa , "array" , None ),
64
+ marks = skip_if_no (package = "pyarrow" ),
65
+ id = "pyarrow" ,
66
+ ),
67
+ ],
68
+ )
69
+ def test_text_multiple_lines_of_text (region , projection , array_func ):
52
70
"""
53
71
Place multiple lines of text at their respective x, y locations.
54
72
"""
@@ -58,7 +76,7 @@ def test_text_multiple_lines_of_text(region, projection):
58
76
projection = projection ,
59
77
x = [1.2 , 1.6 ],
60
78
y = [0.6 , 0.3 ],
61
- text = ["This is a line of text" , "This is another line of text" ],
79
+ text = array_func ( ["This is a line of text" , "This is another line of text" ]) ,
62
80
)
63
81
return fig
64
82
0 commit comments