File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -35,3 +35,20 @@ def test_import_default_module_not_found(mock_import):
3535 default_class = type ("OpsMixin" , (), {}) # Dummy class
3636 result = pandas_backports .import_default ("module_name" , default = default_class )
3737 assert result == default_class
38+
39+
40+ @mock .patch ("builtins.__import__" )
41+ def test_import_default_force_true (mock_import ):
42+ """
43+ Test that when force=True, the default is returned immediately
44+ without attempting an import.
45+ """
46+ default_class = type ("ForcedMixin" , (), {}) # A dummy class
47+
48+ result = pandas_backports .import_default (
49+ "any_module_name" , force = True , default = default_class
50+ )
51+
52+ # Assert that the returned value is the default class itself
53+ assert result is default_class
54+
You can’t perform that action at this time.
0 commit comments