8000 MNT fix ruff type vs isinstance errors by adrinjalali · Pull Request #27039 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
8000

MNT fix ruff type vs isinstance errors #27039

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

Merged
merged 1 commit into from
Aug 9, 2023
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
8 changes: 4 additions & 4 deletions sklearn/metrics/tests/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ def test_classification_report_dictionary_output():
for metric in expected_report[key]:
assert_almost_equal(expected_report[key][metric], report[key][metric])

assert type(expected_report["setosa"]["precision"]) == float
assert type(expected_report["macro avg"]["precision"]) == float
assert type(expected_report["setosa"]["support"]) == int
assert type(expected_report["macro avg"]["support"]) == int
assert isinstance(expected_report["setosa"]["precision"], float)
assert isinstance(expected_report["macro avg"]["precision"], float)
assert isinstance(expected_report["setosa"]["support"], int)
assert isinstance(expected_report["macro avg"]["support"], int)


def test_classification_report_output_dict_empty_input():
Expand Down
2 changes: 1 addition & 1 deletion sklearn/model_selection/_split.py
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2673,7 +2673,7 @@ def _pprint(params, offset=0, printer=repr):
this_line_length = offset
line_sep = ",\n" + (1 + offset // 2) * " "
for i, (k, v) in enumerate(sorted(params.items())):
if type(v) is float:
if isinstance(v, float):
# use str for representing floating point numbers
# this way we get consistent representation across
# architectures and versions.
Expand Down
0