@@ -819,14 +819,24 @@ def test_all_nan():
819819 2.4e-14 , 5e-14 , 7.5e-14 , 1e-13 ])
820820
821821
822+ def test_allsegs_allkinds ():
823+ x , y = np .meshgrid (np .arange (0 , 10 , 2 ), np .arange (0 , 10 , 2 ))
824+ z = np .sin (x ) * np .cos (y )
825+
826+ cs = plt .contour (x , y , z , levels = [0 , 0.5 ])
827+
828+ # Expect two levels, first with 5 segments and the second with 4.
829+ with pytest .warns (PendingDeprecationWarning , match = "all" ):
830+ for result in [cs .allsegs , cs .allkinds ]:
831+ assert len (result ) == 2
832+ assert len (result [0 ]) == 5
833+ assert len (result [1 ]) == 4
834+
835+
822836def test_deprecated_apis ():
823837 cs = plt .contour (np .arange (16 ).reshape ((4 , 4 )))
824838 with pytest .warns (mpl .MatplotlibDeprecationWarning , match = "collections" ):
825839 colls = cs .collections
826- with pytest .warns (PendingDeprecationWarning , match = "allsegs" ):
827- assert cs .allsegs == [p .vertices for c in colls for p in c .get_paths ()]
828- with pytest .warns (PendingDeprecationWarning , match = "allkinds" ):
829- assert cs .allkinds == [p .codes for c in colls for p in c .get_paths ()]
830840 with pytest .warns (mpl .MatplotlibDeprecationWarning , match = "tcolors" ):
831841 assert_array_equal (cs .tcolors , [c .get_edgecolor () for c in colls ])
832842 with pytest .warns (mpl .MatplotlibDeprecationWarning , match = "tlinewidths" ):
0 commit comments