14
14
@pytest .fixture (scope = "module" , name = "legend_spec" )
15
15
def fixture_legend_spec ():
16
16
"""
17
- Return a legend specification file content .
17
+ A string contains a legend specification.
18
18
"""
19
19
return """
20
20
G -0.1i
@@ -47,7 +47,7 @@ def fixture_legend_spec():
47
47
@pytest .mark .mpl_image_compare
48
48
def test_legend_position ():
49
49
"""
50
- Test that plots a position with each of the four legend coordinate systems.
50
+ Test positioning the legend with different coordinate systems.
51
51
"""
52
52
fig = Figure ()
53
53
fig .basemap (region = [- 2 , 2 , - 2 , 2 ], frame = True )
@@ -74,7 +74,7 @@ def test_legend_default_position():
74
74
@pytest .mark .mpl_image_compare
75
75
def test_legend_entries ():
76
76
"""
77
- Test different marker types/shapes .
77
+ Test legend using the automatically generated legend entries .
78
78
"""
79
79
fig = Figure ()
80
80
fig .basemap (projection = "x1i" , region = [0 , 7 , 3 , 7 ], frame = True )
@@ -98,11 +98,9 @@ def test_legend_specfile(legend_spec):
98
98
"""
99
99
with GMTTempFile () as specfile :
100
100
Path (specfile .name ).write_text (legend_spec , encoding = "utf-8" )
101
- spec = specfile .name
102
-
103
101
fig = Figure ()
104
102
fig .basemap (projection = "x6i" , region = [0 , 1 , 0 , 1 ], frame = True )
105
- fig .legend (spec , position = "JTM+jCM+w5i" )
103
+ fig .legend (specfile . name , position = "JTM+jCM+w5i" )
106
104
return fig
107
105
108
106
@@ -125,3 +123,6 @@ def test_legend_fails():
125
123
fig = Figure ()
126
124
with pytest .raises (GMTInvalidInput ):
127
125
fig .legend (spec = ["@Table_5_11.txt" ])
126
+
127
+ with pytest .raises (GMTInvalidInput ):
128
+ fig .legend (spec = [1 , 2 ])
0 commit comments