From 102af1cc07baef1847770f4b49588c37ee749ca5 Mon Sep 17 00:00:00 2001 From: Aravind Pai Date: Wed, 19 Jun 2024 12:13:08 +0000 Subject: [PATCH] remove deprecated non-integer input to randrange() Replace float division with integer division in `create_user()` to ensure integer input to `randint()`, which internally calls `randrange()`. Non-integer inputs to `randrange()` has been deprecated in Python 3.10, and will be removed in a future version. This change also addresses the corresponding python warnings that would appear in the client code that uses the `create_user()` method. --- password_policies/tests/lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/password_policies/tests/lib.py b/password_policies/tests/lib.py index a85eb3c..fe5ea86 100644 --- a/password_policies/tests/lib.py +++ b/password_policies/tests/lib.py @@ -46,7 +46,7 @@ def create_user( if not raw_password: raw_password = passwords[-1] if not date_joined: - rind = randint(0, (duration / count + 1)) + rind = randint(0, (duration // count + 1)) seconds = (count * duration + rind) * 2 date_joined = get_datetime_from_delta(timezone.now(), seconds) if not last_login: