From 33b21e4bcdd01b3cbbbd58a12bcf373dfa193cbc Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Mon, 27 Nov 2023 19:22:08 +0000 Subject: [PATCH] Avoid deprecated use of floats with ngettext tests/test_cgi.py::TestWsgi::test_application linkcheck/strformat.py:190: DeprecationWarning: Plural value must be an integer, got float time_str.append(_n(single, plural, unit) % unit) --- linkcheck/strformat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linkcheck/strformat.py b/linkcheck/strformat.py index 0783fab7..f047fb64 100644 --- a/linkcheck/strformat.py +++ b/linkcheck/strformat.py @@ -22,6 +22,7 @@ Various string utility functions. Note that these functions are not necessarily optimised for large strings, so use with care. """ +import math import re import textwrap import os @@ -187,7 +188,7 @@ def strduration_long(duration, do_translate=True): else: duration, unit = divmod(duration, divisor) if unit: - time_str.append(_n(single, plural, unit) % unit) + time_str.append(_n(single, plural, math.ceil(unit)) % unit) time_str.reverse() if len(time_str) > 2: time_str.pop()