Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix E721 errors #151

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/lightgbm/test_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def test_no_eval_set_args(self) -> None:
callbacks=[early_stopping(stopping_rounds=2)],
)

assert excinfo.type == ValueError
assert excinfo.type is ValueError
assert str(excinfo.value) == "`valid_sets` is required."

@pytest.mark.parametrize(
Expand Down Expand Up @@ -314,7 +314,7 @@ def test_inconsistent_study_direction(self, metric: str, study_direction: str) -
study=study,
)

assert excinfo.type == ValueError
assert excinfo.type is ValueError
assert str(excinfo.value).startswith("Study direction is inconsistent with the metric")

def test_with_minimum_required_args(self) -> None:
Expand Down Expand Up @@ -769,7 +769,7 @@ def test_inconsistent_study_direction(self, metric: str, study_direction: str) -
study=study,
)

assert excinfo.type == ValueError
assert excinfo.type is ValueError
assert str(excinfo.value).startswith("Study direction is inconsistent with the metric")

def test_with_minimum_required_args(self) -> None:
Expand Down
8 changes: 4 additions & 4 deletions tests/sklearn/test_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def test_optuna_search_properties() -> None:
assert np.allclose(optuna_search.classes_, np.array([0, 1, 2]))
assert optuna_search.n_trials_ == 10
assert optuna_search.user_attrs_ == {"dataset": "blobs"}
assert type(optuna_search.predict_log_proba(X)) == np.ndarray
assert type(optuna_search.predict_proba(X)) == np.ndarray
assert isinstance(optuna_search.predict_log_proba(X), np.ndarray)
assert isinstance(optuna_search.predict_proba(X), np.ndarray)


@pytest.mark.filterwarnings("ignore::UserWarning")
Expand All @@ -139,8 +139,8 @@ def test_optuna_search_transforms() -> None:
est, {}, cv=3, error_score="raise", random_state=0, return_train_score=True
)
optuna_search.fit(X)
assert type(optuna_search.transform(X)) == np.ndarray
assert type(optuna_search.inverse_transform(X)) == np.ndarray
assert isinstance(optuna_search.transform(X), np.ndarray)
assert isinstance(optuna_search.inverse_transform(X), np.ndarray)


def test_optuna_search_invalid_estimator() -> None:
Expand Down
Loading