@@ -6426,34 +6426,24 @@ def test_ytickcolor_is_not_markercolor():
6426
6426
assert tick .tick1line .get_markeredgecolor () != 'white'
6427
6427
6428
6428
6429
+ @pytest .mark .parametrize ('axis' , ('x' , 'y' ))
6429
6430
@pytest .mark .parametrize ('auto' , (True , False , None ))
6430
- def test_unautoscaley (auto ):
6431
- fig , ax = plt .subplots ()
6432
- x = np .arange (100 )
6433
- y = np .linspace (- .1 , .1 , 100 )
6434
- ax .scatter (x , y )
6435
-
6436
- post_auto = ax .get_autoscaley_on () if auto is None else auto
6437
-
6438
- ax .set_ylim ((- .5 , .5 ), auto = auto )
6439
- assert post_auto == ax .get_autoscaley_on ()
6440
- fig .canvas .draw ()
6441
- assert_array_equal (ax .get_ylim (), (- .5 , .5 ))
6442
-
6443
-
6444
- @pytest .mark .parametrize ('auto' , (True , False , None ))
6445
- def test_unautoscalex (auto ):
6431
+ def test_unautoscale (axis , auto ):
6446
6432
fig , ax = plt .subplots ()
6447
6433
x = np .arange (100 )
6448
6434
y = np .linspace (- .1 , .1 , 100 )
6449
6435
ax .scatter (y , x )
6450
6436
6451
- post_auto = ax .get_autoscalex_on () if auto is None else auto
6437
+ get_autoscale_on = getattr (ax , f'get_autoscale{ axis } _on' )
6438
+ set_lim = getattr (ax , f'set_{ axis } lim' )
6439
+ get_lim = getattr (ax , f'get_{ axis } lim' )
6440
+
6441
+ post_auto = get_autoscale_on () if auto is None else auto
6452
6442
6453
- ax . set_xlim ((- .5 , .5 ), auto = auto )
6454
- assert post_auto == ax . get_autoscalex_on ()
6443
+ set_lim ((- 0 .5 , 0 .5 ), auto = auto )
6444
+ assert post_auto == get_autoscale_on ()
6455
6445
fig .canvas .draw ()
6456
- assert_array_equal (ax . get_xlim (), (- .5 , .5 ))
6446
+ assert_array_equal (get_lim (), (- 0 .5 , 0 .5 ))
6457
6447
6458
6448
6459
6449
@check_figures_equal (extensions = ["png" ])
0 commit comments