@@ -3833,16 +3833,24 @@ def test_stem(use_line_collection):
38333833
38343834
38353835def test_stem_args ():
3836+ def _assert_equal (stem_container , expected ):
3837+ x , y = map (list , stem_container .markerline .get_data ())
3838+ assert x == expected [0 ]
3839+ assert y == expected [1 ]
3840+
38363841 fig , ax = plt .subplots ()
38373842
3838- x = list ( range ( 10 ))
3839- y = list ( range ( 10 ))
3843+ x = [ 1 , 3 , 5 ]
3844+ y = [ 9 , 8 , 7 ]
38403845
38413846 # Test the call signatures
3842- ax .stem (y )
3843- ax .stem (x , y )
3844- ax .stem (x , y , linefmt = 'r--' )
3845- ax .stem (x , y , linefmt = 'r--' , basefmt = 'b--' )
3847+ _assert_equal (ax .stem (y ), expected = ([0 , 1 , 2 ], y ))
3848+ _assert_equal (ax .stem (x , y ), expected = (x , y ))
3849+ _assert_equal (ax .stem (x , y , linefmt = 'r--' ), expected = (x , y ))
3850+ _assert_equal (ax .stem (x , y , 'r--' ), expected = (x , y ))
3851+ _assert_equal (ax .stem (x , y , linefmt = 'r--' , basefmt = 'b--' ), expected = (x , y ))
3852+ _assert_equal (ax .stem (y , linefmt = 'r--' ), expected = ([0 , 1 , 2 ], y ))
3853+ _assert_equal (ax .stem (y , 'r--' ), expected = ([0 , 1 , 2 ], y ))
38463854
38473855
38483856def test_stem_dates ():
0 commit comments