Skip to content

Commit

Permalink
fix one unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
xadupre committed Sep 7, 2024
1 parent 2aceb23 commit 69e9ef5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
11 changes: 7 additions & 4 deletions mlinsights/mlmodel/categories_to_integers.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ def transform(v, vec):
if len(lv) > 20:
lv = lv[:20]
lv.append("...")
m = "\n".join(map(str, lv))
raise ValueError(
"Unable to find category value %r type(v)=%r "
"among\n%s" % (v, type(v), "\n".join(lv))
f"Unable to find category value {v} "
f"type(v)={type(v)} among\n{m}"
)
return numpy.nan

Expand Down Expand Up @@ -178,10 +179,12 @@ def transform(v, vec):
if len(lv) > 20:
lv = lv[:20]
lv.append("...")
m = "\n".join(map(str, lv))
raise ValueError(
"Unable to find category value %r: %r "
"type(v)=%r among\n%s" % (k, v, type(v), "\n".join(lv))
f"Unable to find category value {k}: {v} "
f"type(v)={type(v)} among\n{m}"
)
p = pos[k]
else:
p = pos[k] + vec[k][v]
res[i, p] = 1.0
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ changelog = "https://sdpython.github.io/doc/mlinsights/dev/CHANGELOGS.html"

[project.optional-dependencies]
dev = [
"autopep8",
"black",
"clang-format",
"cmakelang",
"coverage",
"cython",
"cython-lint",
"flake8",
"furo",
"isort",
"joblib",
Expand Down Expand Up @@ -174,7 +172,13 @@ select = [
]

[tool.ruff.lint.per-file-ignores]
"**" = ["B905", "C401", "C408", "C413", "RUF012", "RUF100", "RUF010", "SIM108", "SIM910", "SIM110", "SIM102", "SIM114", "SIM103", "UP015", "UP027", "UP031", "UP034", "UP032", "UP006", "UP035", "UP007", "UP038"]
"**" = [
"B905",
"C401", "C408", "C413",
"RUF012", "RUF100", "RUF010",
"SIM108", "SIM910", "SIM110", "SIM102", "SIM114", "SIM103", "UP015",
"UP027", "UP031", "UP034", "UP032", "UP006", "UP035", "UP007", "UP038"
]
"**/plot*.py" = ["B018"]
"_unittests/**.py" = ["B904", "RUF015", "C400"]
"_unittests/ut_plotting/test_dot.py" = ["E501"]
Expand Down

0 comments on commit 69e9ef5

Please sign in to comment.