@@ -64,45 +64,22 @@ def test_solar_set_terminator_datetime(terminator_datetime):
6464 return fig
6565
6666
67- def test_invalid_terminator_type ():
68- """
69- Test if solar fails when it receives an invalid terminator type.
70- """
71- fig = Figure ()
72- with pytest .raises (GMTValueError ):
73- fig .solar (
74- region = "d" ,
75- projection = "W0/15c" ,
76- frame = "a" ,
77- terminator = "invalid" ,
78- )
79-
80-
81- def test_invalid_parameter ():
82- """
83- Test if solar fails when it receives a GMT argument for 'T' instead of the PyGMT
84- arguments for 'terminator' and 'terminator_datetime'.
85- """
86- fig = Figure ()
87- with pytest .raises (GMTParameterError ):
88- # Use single-letter parameter 'T' for testing
89- fig .solar (
90- region = "d" , projection = "W0/15c" , frame = "a" , T = "d+d1990-02-17T04:25:00"
91- )
92-
93-
94- def test_invalid_datetime ():
67+ @pytest .mark .parametrize (
68+ ("kwargs" , "expected_exception" ),
69+ [
70+ ({"terminator" : "invalid" }, GMTValueError ),
71+ ({"T" : "d+d1990-02-17T04:25:00" }, GMTParameterError ),
72+ ({"terminator_datetime" : "199A-02-17 04:25:00" }, GMTValueError ),
73+ ],
74+ )
75+ def test_solar_invalid_inputs (kwargs , expected_exception ):
9576 """
96- Test if solar fails when it receives an invalid datetime string.
77+ Test if the appropriate error is raised when an invalid
78+ value is passed.
9779 """
9880 fig = Figure ()
99- with pytest .raises (GMTValueError ):
100- fig .solar (
101- region = "d" ,
102- projection = "W0/15c" ,
103- frame = "a" ,
104- terminator_datetime = "199A-02-17 04:25:00" ,
105- )
81+ with pytest .raises (expected_exception ):
82+ fig .solar (region = "d" , projection = "W0/15c" , frame = "a" , ** kwargs )
10683
10784
10885@pytest .mark .mpl_image_compare (filename = "test_solar_set_terminator_datetime.png" )
0 commit comments