Skip to content

Commit a30812e

Browse files
sawa3030gen740
authored andcommitted
update tests
1 parent 11da9c8 commit a30812e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

tests/samplers_tests/test_base_gasampler.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,8 @@ def test_get_parent_population(args: dict[str, Any]) -> None:
215215
mock_study = MagicMock()
216216
mock_study._storage.get_study_system_attrs.return_value = args["study_system_attrs"]
217217
if args["cache"]:
218-
219-
class StrictTrialMock(MagicMock):
220-
def __getattr__(self, name: str) -> Any:
221-
if name != "_trial_id":
222-
raise AttributeError(f"Access to attribute '{name}' is not allowed.")
223-
return super().__getattr__(name)
224-
225218
mock_study._get_trials.return_value = [
226-
StrictTrialMock(_trial_id=i)
219+
MagicMock(_trial_id=i)
227220
for i in args["study_system_attrs"][
228221
BaseGASamplerTestSampler._get_parent_cache_key_prefix() + "1"
229222
]
@@ -247,6 +240,7 @@ def __getattr__(self, name: str) -> Any:
247240

248241
if args["cache"]:
249242
assert return_value == mock_study._get_trials.return_value
243+
assert mock_select_parent.call_count == 0
250244
mock_study._get_trials.assert_called_once_with(deepcopy=False)
251245
else:
252246
mock_select_parent.assert_called_once_with(mock_study, args["generation"])

0 commit comments

Comments
 (0)