99from pathlib import Path
1010from unittest .mock import Mock , patch
1111
12+ from pytest_mock import MockerFixture
1213import win32gui
1314from test .conftest import DISPLAYS1 , DISPLAYS2 , RULES1 , RULES2 , WINDOWS1 , WINDOWS2
1415
@@ -210,16 +211,18 @@ def sample_json(self, window_json):
210211 def sample_cls (self , window_cls ):
211212 return window_cls
212213
213- def test_fits_display (self , klass : WindowType , sample_json , display_json , expected = None ):
214+ def test_fits_display (self , klass : WindowType , mocker : MockerFixture , sample_json , display_json , expected = None ):
214215 if expected is None :
215216 expected = (sample_json in WINDOWS1 and display_json in DISPLAYS1 ) or (
216217 sample_json in WINDOWS2 and display_json in DISPLAYS2
217218 )
218219 instance = klass .from_json (sample_json )
220+ mocker .patch .object (instance , 'get_border_and_shadow_thickness' , Mock (spec = True , return_value = 8 ))
219221 display_json = Display .from_json (display_json )
220222 assert instance .fits_display (display_json ) is expected
221223
222- def test_fits_display_config (self , sample_cls : WindowType , displays : list [Display ]):
224+ def test_fits_display_config (self , sample_cls : WindowType , mocker : MockerFixture , displays : list [Display ]):
225+ mocker .patch .object (sample_cls , 'get_border_and_shadow_thickness' , Mock (spec = True , return_value = 8 ))
223226 assert sample_cls .fits_display_config (displays ) is True
224227
225228
@@ -243,11 +246,11 @@ def test_post_init(self, klass: Rule):
243246 assert instance .name is not None
244247 assert isinstance (instance .name , str )
245248
246- def test_fits_display (self , klass : Rule , sample_json , display_json ):
249+ def test_fits_display (self , klass : Rule , mocker : MockerFixture , sample_json , display_json ):
247250 expected = (sample_json in RULES1 and display_json in DISPLAYS1 ) or (
248251 sample_json in RULES2 and display_json in DISPLAYS2
249252 )
250- return super ().test_fits_display (klass , sample_json , display_json , expected )
253+ return super ().test_fits_display (klass , mocker , sample_json , display_json , expected )
251254
252255
253256class TestSnapshot (TestJSONType ):
0 commit comments