Skip to content

Commit

Permalink
remove deprecated non-integer input to randrange()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dragondive committed Jun 19, 2024
1 parent fb35294 commit 102af1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion password_policies/tests/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 102af1c

Please sign in to comment.