Skip to content

Commit 551e076

Browse files
committed
Update _transform_passed_failed()
1 parent b1cc66a commit 551e076

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pointblank/validate.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13926,14 +13926,24 @@ def _transform_passed_failed(
1392613926
interrogation_performed: bool,
1392713927
active: list[bool],
1392813928
locale: str,
13929+
df_lib=None,
1392913930
) -> list[str]:
1393013931
if not interrogation_performed:
1393113932
return ["" for _ in range(len(n_passed_failed))]
1393213933

13934+
# Helper function to format numbers safely
13935+
def _format_float_safe(value: float) -> str:
13936+
if df_lib is not None:
13937+
# Use GT-based formatting to avoid Pandas dependency completely
13938+
return _format_single_float_with_gt(value, decimals=2, locale=locale, df_lib=df_lib)
13939+
else:
13940+
# Fallback to the original behavior
13941+
return vals.fmt_number(value, decimals=2, locale=locale)[0]
13942+
1393313943
passed_failed = [
1393413944
(
13935-
f"{n_passed_failed[i] if n_passed_failed[i] < 10000 else _fmt_lg(n_passed_failed[i], locale=locale)}"
13936-
f"<br />{vals.fmt_number(f_passed_failed[i], decimals=2, locale=locale)[0]}"
13945+
f"{n_passed_failed[i] if n_passed_failed[i] < 10000 else _fmt_lg(n_passed_failed[i], locale=locale, df_lib=df_lib)}"
13946+
f"<br />{_format_float_safe(f_passed_failed[i])}"
1393713947
if active[i]
1393813948
else "&mdash;"
1393913949
)

0 commit comments

Comments
 (0)