@@ -6717,34 +6717,24 @@ def test_ytickcolor_is_not_markercolor():
6717
6717
assert tick .tick1line .get_markeredgecolor () != 'white'
6718
6718
6719
6719
6720
+ @pytest .mark .parametrize ('axis' , ('x' , 'y' ))
6720
6721
@pytest .mark .parametrize ('auto' , (True , False , None ))
6721
- def test_unautoscaley (auto ):
6722
- fig , ax = plt .subplots ()
6723
- x = np .arange (100 )
6724
- y = np .linspace (- .1 , .1 , 100 )
6725
- ax .scatter (x , y )
6726
-
6727
- post_auto = ax .get_autoscaley_on () if auto is None else auto
6728
-
6729
- ax .set_ylim ((- .5 , .5 ), auto = auto )
6730
- assert post_auto == ax .get_autoscaley_on ()
6731
- fig .canvas .draw ()
6732
- assert_array_equal (ax .get_ylim (), (- .5 , .5 ))
6733
-
6734
-
6735
- @pytest .mark .parametrize ('auto' , (True , False , None ))
6736
- def test_unautoscalex (auto ):
6722
+ def test_unautoscale (axis , auto ):
6737
6723
fig , ax = plt .subplots ()
6738
6724
x = np .arange (100 )
6739
6725
y = np .linspace (- .1 , .1 , 100 )
6740
6726
ax .scatter (y , x )
6741
6727
6742
- post_auto = ax .get_autoscalex_on () if auto is None else auto
6728
+ get_autoscale_on = getattr (ax , f'get_autoscale{ axis } _on' )
6729
+ set_lim = getattr (ax , f'set_{ axis } lim' )
6730
+ get_lim = getattr (ax , f'get_{ axis } lim' )
6731
+
6732
+ post_auto = get_autoscale_on () if auto is None else auto
6743
6733
6744
- ax . set_xlim ((- .5 , .5 ), auto = auto )
6745
- assert post_auto == ax . get_autoscalex_on ()
6734
+ set_lim ((- 0 .5 , 0 .5 ), auto = auto )
6735
+ assert post_auto == get_autoscale_on ()
6746
6736
fig .canvas .draw ()
6747
- assert_array_equal (ax . get_xlim (), (- .5 , .5 ))
6737
+ assert_array_equal (get_lim (), (- 0 .5 , 0 .5 ))
6748
6738
6749
6739
6750
6740
@check_figures_equal (extensions = ["png" ])
0 commit comments