@@ -18,26 +18,38 @@ def test_patch_transform_of_none():
1818 ax .set_xlim ([1 , 3 ])
1919 ax .set_ylim ([1 , 3 ])
2020
21- #draw an ellipse over data coord (2,2) by specifying device coords
21+ # Draw an ellipse over data coord (2,2) by specifying device coords.
2222 xy_data = (2 , 2 )
2323 xy_pix = ax .transData .transform_point (xy_data )
2424
25- # not providing a transform of None puts the ellipse in data coordinates
25+ # Not providing a transform of None puts the ellipse in data coordinates .
2626 e = mpatches .Ellipse (xy_data , width = 1 , height = 1 , fc = 'yellow' , alpha = 0.5 )
2727 ax .add_patch (e )
2828 assert e ._transform == ax .transData
2929
30- # providing a transform of None puts the ellipse in device coordinates
30+ # Providing a transform of None puts the ellipse in device coordinates.
3131 e = mpatches .Ellipse (xy_pix , width = 120 , height = 120 , fc = 'coral' ,
3232 transform = None , alpha = 0.5 )
33+ assert e .is_transform_set () is True
3334 ax .add_patch (e )
3435 assert isinstance (e ._transform , mtrans .IdentityTransform )
3536
36- # providing an IdentityTransform puts the ellipse in device coordinates
37+ # Providing an IdentityTransform puts the ellipse in device coordinates.
3738 e = mpatches .Ellipse (xy_pix , width = 100 , height = 100 ,
3839 transform = mtrans .IdentityTransform (), alpha = 0.5 )
3940 ax .add_patch (e )
4041 assert isinstance (e ._transform , mtrans .IdentityTransform )
42+
43+ # Not providing a transform, and then subsequently "get_transform" should
44+ # not mean that "is_transform_set".
45+ e = mpatches .Ellipse (xy_pix , width = 120 , height = 120 , fc = 'coral' ,
46+ alpha = 0.5 )
47+ intermediate_transform = e .get_transform ()
48+ assert e .is_transform_set () is False
49+ ax .add_patch (e )
50+ assert e .get_transform () != intermediate_transform
51+ assert e .is_transform_set () is True
52+ assert e ._transform == ax .transData
4153
4254
4355@cleanup
0 commit comments