@@ -5096,7 +5096,8 @@ def test_shared_aspect_error():
50965096 r"axis\(\) takes 0 or 1 positional arguments but 2"
50975097 " were given" ),
50985098 (ValueError , ('foo' , ), {},
5099- "Unrecognized string foo to axis; try on or off" ),
5099+ "Unrecognized string 'foo' to axis; try 'on' or "
5100+ "'off'" ),
51005101 (TypeError , ([1 , 2 ], ), {},
51015102 "the first argument to axis*" ),
51025103 (TypeError , tuple (), {'foo' : None },
@@ -7676,6 +7677,19 @@ def test_empty_line_plots():
76767677 assert len (line ) == 1
76777678
76787679
7680+ @pytest .mark .parametrize ('fmt, match' , (
7681+ ("foo" , "Unrecognized character f in format string 'foo'" ),
7682+ ("o+" , "Illegal format string 'o\\ +'; two marker symbols" ),
7683+ (":-" , "Illegal format string ':-'; two linestyle symbols" ),
7684+ ("rk" , "Illegal format string 'rk'; two color symbols" ),
7685+ (":o-r" , "Illegal format string ':o-r'; two linestyle symbols" ),
7686+ ))
7687+ def test_plot_format_errors (fmt , match ):
7688+ fig , ax = plt .subplots ()
7689+ with pytest .raises (ValueError , match = match ):
7690+ ax .plot ((0 , 0 ), fmt )
7691+
7692+
76797693def test_clim ():
76807694 ax = plt .figure ().add_subplot ()
76817695 for plot_method in [
0 commit comments