Skip to content

Commit

Permalink
fix PEP warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cuent committed Jan 9, 2022
1 parent 247dd79 commit 3a7f051
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/classification/test_f_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,13 @@ def test_no_support(metric_class, metric_fn):
assert result_cl == result_fn == 0


@pytest.mark.parametrize("metric_class, metric_fn", [(partial(FBeta, beta=2.0), partial(fbeta, beta=2.0)), (F1Score, f1_score_pl)])
@pytest.mark.parametrize(
"metric_class, metric_fn",
[
(partial(FBeta, beta=2.0), partial(fbeta, beta=2.0)),
(F1Score, f1_score_pl),
]
)
@pytest.mark.parametrize(
"ignore_index, expected", [(None, torch.tensor([1.0, np.nan])), (0, torch.tensor([np.nan, np.nan]))]
)
Expand All @@ -202,7 +208,10 @@ def test_class_not_present(metric_class, metric_fn, ignore_index, expected):

@pytest.mark.parametrize(
"metric_class, metric_fn, sk_fn",
[(partial(FBeta, beta=2.0), partial(fbeta, beta=2.0), partial(fbeta_score, beta=2.0)), (F1Score, f1_score_pl, f1_score)],
[
(partial(FBeta, beta=2.0), partial(fbeta, beta=2.0), partial(fbeta_score, beta=2.0)),
(F1Score, f1_score_pl, f1_score),
],
)
@pytest.mark.parametrize("average", ["micro", "macro", None, "weighted", "samples"])
@pytest.mark.parametrize("ignore_index", [None, 0])
Expand Down Expand Up @@ -430,7 +439,10 @@ def test_top_k(
@pytest.mark.parametrize("average", ["micro", "macro", "weighted"])
@pytest.mark.parametrize(
"metric_class, metric_functional, sk_fn",
[(partial(FBeta, beta=2.0), partial(fbeta, beta=2.0), partial(fbeta_score, beta=2.0)), (F1Score, f1_score_pl, f1_score)],
[
(partial(FBeta, beta=2.0), partial(fbeta, beta=2.0), partial(fbeta_score, beta=2.0)),
(F1Score, f1_score_pl, f1_score)
],
)
def test_same_input(metric_class, metric_functional, sk_fn, average, ignore_index):
preds = _input_miss_class.preds
Expand Down

0 comments on commit 3a7f051

Please sign in to comment.