Skip to content

Commit

Permalink
Fix E721 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nzw0301 committed Aug 17, 2024
1 parent f08ee22 commit e765fc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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

0 comments on commit e765fc8

Please sign in to comment.