def test_any(self): """should return True if any dones is True if early_stopping is 'any'.""" tests = TaskList(None, early_stopping="any") tests.dones = [True, False, True] check.is_true(tests._stacked_dones()) tests.dones = [False, False, False] check.is_false(tests._stacked_dones())
def test_all(self): """should return True only if all dones are True if early_stopping is 'all'.""" tests = TaskList(None, early_stopping="all") done = tests.dones = [True, False, True] check.is_false(tests._stacked_dones()) done = tests.dones = [True, True, True] check.is_true(tests._stacked_dones())
def test_raise_othervalue(self): """should raise ValueError if early_stopping is not in ('any', 'all').""" tests = TaskList(None, early_stopping="x") tests.dones = [True, False, True] with pytest.raises(ValueError, match=r"Unknown value for early_stopping.*"): tests._stacked_dones()