Skip to content

Commit

Permalink
Add timeframe to warning about using find_first_match without ensure_…
Browse files Browse the repository at this point in the history
…strategy (#303)

* Add timeframe to warning about using find_first_match without ensure_strategy

* lint
  • Loading branch information
ludeeus authored Mar 20, 2024
1 parent 9c7510f commit 79f53cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion awesomeversion/awesomeversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def __init__(

if find_first_match and not ensure_strategy:
warn(
"Can not use find_first_match without ensure_strategy",
"Can not use find_first_match without ensure_strategy, "
"this is ignored and will start raising an exception in 2025.",
stacklevel=2,
)

Expand Down
6 changes: 4 additions & 2 deletions tests/test_awesomeversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@ def test_find_first_match_exception() -> None:
"""Test"""
with warnings.catch_warnings(record=True) as warning_list:
assert AwesomeVersion("1", find_first_match=True)
assert "Can not use find_first_match without ensure_strategy" in str(
warning_list[-1].message
assert (
"Can not use find_first_match without ensure_strategy, "
"this is ignored and will start raising an exception in 2025."
in str(warning_list[-1].message)
)


Expand Down

0 comments on commit 79f53cc

Please sign in to comment.