@@ -5095,7 +5095,8 @@ def test_shared_aspect_error():
5095
5095
r"axis\(\) takes 0 or 1 positional arguments but 2"
5096
5096
" were given" ),
5097
5097
(ValueError , ('foo' , ), {},
5098
- "Unrecognized string foo to axis; try on or off" ),
5098
+ "Unrecognized string 'foo' to axis; try 'on' or "
5099
+ "'off'" ),
5099
5100
(TypeError , ([1 , 2 ], ), {},
5100
5101
"the first argument to axis*" ),
5101
5102
(TypeError , tuple (), {'foo' : None },
@@ -7574,6 +7575,19 @@ def test_empty_line_plots():
7574
7575
assert len (line ) == 1
7575
7576
7576
7577
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
+
7577
7591
def test_clim ():
7578
7592
ax = plt .figure ().add_subplot ()
7579
7593
for plot_method in [
0 commit comments