@@ -6391,34 +6391,24 @@ def test_ytickcolor_is_not_markercolor():
6391
6391
assert tick .tick1line .get_markeredgecolor () != 'white'
6392
6392
6393
6393
6394
+ @pytest .mark .parametrize ('axis' , ('x' , 'y' ))
6394
6395
@pytest .mark .parametrize ('auto' , (True , False , None ))
6395
- def test_unautoscaley (auto ):
6396
- fig , ax = plt .subplots ()
6397
- x = np .arange (100 )
6398
- y = np .linspace (- .1 , .1 , 100 )
6399
- ax .scatter (x , y )
6400
-
6401
- post_auto = ax .get_autoscaley_on () if auto is None else auto
6402
-
6403
- ax .set_ylim ((- .5 , .5 ), auto = auto )
6404
- assert post_auto == ax .get_autoscaley_on ()
6405
- fig .canvas .draw ()
6406
- assert_array_equal (ax .get_ylim (), (- .5 , .5 ))
6407
-
6408
-
6409
- @pytest .mark .parametrize ('auto' , (True , False , None ))
6410
- def test_unautoscalex (auto ):
6396
+ def test_unautoscale (axis , auto ):
6411
6397
fig , ax = plt .subplots ()
6412
6398
x = np .arange (100 )
6413
6399
y = np .linspace (- .1 , .1 , 100 )
6414
6400
ax .scatter (y , x )
6415
6401
6416
- post_auto = ax .get_autoscalex_on () if auto is None else auto
6402
+ get_autoscale_on = getattr (ax , f'get_autoscale{ axis } _on' )
6403
+ set_lim = getattr (ax , f'set_{ axis } lim' )
6404
+ get_lim = getattr (ax , f'get_{ axis } lim' )
6405
+
6406
+ post_auto = get_autoscale_on () if auto is None else auto
6417
6407
6418
- ax . set_xlim ((- .5 , .5 ), auto = auto )
6419
- assert post_auto == ax . get_autoscalex_on ()
6408
+ set_lim ((- 0 .5 , 0 .5 ), auto = auto )
6409
+ assert post_auto == get_autoscale_on ()
6420
6410
fig .canvas .draw ()
6421
- assert_array_equal (ax . get_xlim (), (- .5 , .5 ))
6411
+ assert_array_equal (get_lim (), (- 0 .5 , 0 .5 ))
6422
6412
6423
6413
6424
6414
@check_figures_equal (extensions = ["png" ])
0 commit comments