@@ -31,6 +31,18 @@ def mock_matplotlib(mocker):
3131 _get_lines .get_next_color .return_value = "next-color"
3232 ax ._get_lines = _get_lines
3333
34+ # Mock shared axes methods for flow parameter support
35+ mock_shared_axes = mocker .Mock ()
36+ mock_shared_axes .get_siblings .return_value = [
37+ ax
38+ ] # Return list containing current axis
39+ ax .get_shared_x_axes .return_value = mock_shared_axes
40+
41+ # Mock position method
42+ mock_position = mocker .Mock ()
43+ mock_position .x0 = 0.1 # Arbitrary x-position value
44+ ax .get_position .return_value = mock_position
45+
3446 mpl = mocker .patch ("matplotlib.pyplot" , autospec = True )
3547 mocker .patch ("matplotlib.pyplot.subplots" , return_value = (fig , ax ))
3648
@@ -44,7 +56,7 @@ def test_simple(mock_matplotlib):
4456 bins = [0 , 1 , 2 , 3 ]
4557 mh .histplot (h , bins , yerr = True , label = "X" , ax = ax )
4658
47- assert len (ax .mock_calls ) == 13
59+ assert len (ax .mock_calls ) == 17 # Updated count due to shared axes functionality
4860
4961 ax .stairs .assert_called_once_with (
5062 values = approx ([1.0 , 3.0 , 2.0 ]),
@@ -89,15 +101,15 @@ def test_histplot_real(mock_matplotlib):
89101 mh .histplot ([a , b , c ], bins = bins , ax = ax , yerr = True , label = ["MC1" , "MC2" , "Data" ])
90102 ax .legend ()
91103 ax .set_title ("Raw" )
92- assert len (ax .mock_calls ) == 27
104+ assert len (ax .mock_calls ) == 31 # Updated count due to shared axes functionality
93105
94106 ax .reset_mock ()
95107
96108 mh .histplot ([a , b ], bins = bins , ax = ax , stack = True , label = ["MC1" , "MC2" ])
97109 mh .histplot ([c ], bins = bins , ax = ax , yerr = True , histtype = "errorbar" , label = "Data" )
98110 ax .legend ()
99111 ax .set_title ("Data/MC" )
100- assert len (ax .mock_calls ) == 20
112+ assert len (ax .mock_calls ) == 28 # Updated count due to shared axes functionality
101113 ax .reset_mock ()
102114
103115 mh .histplot (
@@ -114,7 +126,7 @@ def test_histplot_real(mock_matplotlib):
114126 )
115127 ax .legend ()
116128 ax .set_title ("Data/MC binwnorm" )
117- assert len (ax .mock_calls ) == 20
129+ assert len (ax .mock_calls ) == 28 # Updated count due to shared axes functionality
118130 ax .reset_mock ()
119131
120132 mh .histplot (
@@ -131,4 +143,4 @@ def test_histplot_real(mock_matplotlib):
131143 )
132144 ax .legend ()
133145 ax .set_title ("Data/MC Density" )
134- assert len (ax .mock_calls ) == 20
146+ assert len (ax .mock_calls ) == 28 # Updated count due to shared axes functionality
0 commit comments