File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,25 @@ def test_contour_empty_levels():
143
143
assert len (record ) == 1
144
144
145
145
146
+ def test_contour_badlevel_fmt ():
147
+ # test funny edge case from
148
+ # https://github.com/matplotlib/matplotlib/issues/9742
149
+ # User supplied fmt for each level as a dictionary, but
150
+ # MPL changed the level to the minimum data value because
151
+ # no contours possible.
152
+ # This would error out pre
153
+ # https://github.com/matplotlib/matplotlib/pull/9743
154
+ x = np .arange (9 )
155
+ z = np .zeros ((9 , 9 ))
156
+
157
+ fig , ax = plt .subplots ()
158
+ fmt = {1. : '%1.2f' }
159
+ with pytest .warns (UserWarning ) as record :
160
+ cs = ax .contour (x , x , z , levels = [1. ])
161
+ ax .clabel (cs , fmt = fmt )
162
+ assert len (record ) == 1
163
+
164
+
146
165
def test_contour_uniform_z ():
147
166
4006
code>
148
167
x = np .arange (9 )
You can’t perform that action at this time.
0 commit comments