@@ -5095,7 +5095,8 @@ def test_shared_aspect_error():
50955095 r"axis\(\) takes 0 or 1 positional arguments but 2"
50965096 " were given" ),
50975097 (ValueError , ('foo' , ), {},
5098- "Unrecognized string foo to axis; try on or off" ),
5098+ "Unrecognized string 'foo' to axis; try 'on' or "
5099+ "'off'" ),
50995100 (TypeError , ([1 , 2 ], ), {},
51005101 "the first argument to axis*" ),
51015102 (TypeError , tuple (), {'foo' : None },
@@ -7574,6 +7575,19 @@ def test_empty_line_plots():
75747575 assert len (line ) == 1
75757576
75767577
7578+ @pytest .mark .parametrize ('fmt, match' , (
7579+ ("foo" , "Unrecognized character f in format string 'foo'" ),
7580+ ("o+" , "Illegal format string 'o\\ +'; two marker symbols" ),
7581+ (":-" , "Illegal format string ':-'; two linestyle symbols" ),
7582+ ("rk" , "Illegal format string 'rk'; two color symbols" ),
7583+ (":o-r" , "Illegal format string ':o-r'; two linestyle symbols" ),
7584+ ))
7585+ def test_plot_format_errors (fmt , match ):
7586+ fig , ax = plt .subplots ()
7587+ with pytest .raises (ValueError , match = match ):
7588+ ax .plot ((0 , 0 ), fmt )
7589+
7590+
75777591def test_clim ():
75787592 ax = plt .figure ().add_subplot ()
75797593 for plot_method in [
0 commit comments