8000 MNT fix ruff type vs isinstance errors (#27039) · scikit-learn/scikit-learn@75cdfec · GitHub
[go: up one dir, main page]

Skip to content

Commit 75cdfec

Browse files
adrinjalalijeremiedbb
authored andcommitted
MNT fix ruff type vs isinstance errors (#27039)
1 parent 4182eaa commit 75cdfec

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sklearn/metrics/tests/test_classification.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ def test_classification_report_dictionary_output():
159159
for metric in expected_report[key]:
160160
assert_almost_equal(expected_report[key][metric], report[key][metric])
161161

162-
assert type(expected_report["setosa"]["precision"]) == float
163-
assert type(expected_report["macro avg"]["precision"]) == float
164-
assert type(expected_report["setosa"]["support"]) == int
165-
assert type(expected_report["macro avg"]["support"]) == int
162+
assert isinstance(expected_report["setosa"]["precision"], float)
163+
assert isinstance(expected_report["macro avg"]["precision"], float)
164+
assert isinstance(expected_report["setosa"]["support"], int)
165+
assert isinstance(expected_report["macro avg"]["support"], int)
166166

167167

168168
def test_classification_report_output_dict_empty_input():

sklearn/model_selection/_split.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2673,7 +2673,7 @@ def _pprint(params, offset=0, printer=repr):
26732673
this_line_length = offset
26742674
line_sep = ",\n" + (1 + offset // 2) * " "
26752675
for i, (k, v) in enumerate(sorted(params.items())):
2676-
if type(v) is float:
2676+
if isinstance(v, float):
26772677
# use str for representing floating point numbers
26782678
# this way we get consistent representation across
26792679
# architectures and versions.

0 commit comments

Comments
 (0)
0