Skip to content

Commit

Permalink
fix: Use module-level function in test_is_uuid_in_percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Dec 17, 2024
1 parent 2124e7b commit 04afb99
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/basic/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,32 +108,32 @@ def test_need_to_ask(temp_data_dir):


def test_is_uuid_in_percentage():
analytics = Analytics()
from aider.analytics import is_uuid_in_percentage

# Test basic percentage thresholds
assert analytics.is_uuid_in_percentage("00000000000000000000000000000000", 1) is True
assert analytics.is_uuid_in_percentage("01999000000000000000000000000000", 1) is True
assert analytics.is_uuid_in_percentage("02000000000000000000000000000000", 1) is True
assert analytics.is_uuid_in_percentage("02910000000000000000000000000001", 1) is False
assert analytics.is_uuid_in_percentage("03000000000000000000000000000000", 1) is False
assert analytics.is_uuid_in_percentage("ff000000000000000000000000000000", 1) is False

assert analytics.is_uuid_in_percentage("00000000000000000000000000000000", 10) is True
assert analytics.is_uuid_in_percentage("19000000000000000000000000000000", 10) is True
assert analytics.is_uuid_in_percentage("1a000000000000000000000000000000", 10) is False
assert analytics.is_uuid_in_percentage("ff000000000000000000000000000000", 10) is False
assert is_uuid_in_percentage("00000000000000000000000000000000", 1) is True
assert is_uuid_in_percentage("01999000000000000000000000000000", 1) is True
assert is_uuid_in_percentage("02000000000000000000000000000000", 1) is True
assert is_uuid_in_percentage("02910000000000000000000000000001", 1) is False
assert is_uuid_in_percentage("03000000000000000000000000000000", 1) is False
assert is_uuid_in_percentage("ff000000000000000000000000000000", 1) is False

assert is_uuid_in_percentage("00000000000000000000000000000000", 10) is True
assert is_uuid_in_percentage("19000000000000000000000000000000", 10) is True
assert is_uuid_in_percentage("1a000000000000000000000000000000", 10) is False
assert is_uuid_in_percentage("ff000000000000000000000000000000", 10) is False

# Test edge cases
assert analytics.is_uuid_in_percentage("00000000000000000000000000000000", 0) is False
assert analytics.is_uuid_in_percentage("00000000000000000000000000000000", 100) is True
assert analytics.is_uuid_in_percentage("ffffffffffffffffffffffffffffffff", 100) is True
assert is_uuid_in_percentage("00000000000000000000000000000000", 0) is False
assert is_uuid_in_percentage("00000000000000000000000000000000", 100) is True
assert is_uuid_in_percentage("ffffffffffffffffffffffffffffffff", 100) is True

# Test invalid inputs
with pytest.raises(ValueError):
analytics.is_uuid_in_percentage("00000000000000000000000000000000", -1)
is_uuid_in_percentage("00000000000000000000000000000000", -1)
with pytest.raises(ValueError):
analytics.is_uuid_in_percentage("00000000000000000000000000000000", 101)
is_uuid_in_percentage("00000000000000000000000000000000", 101)

# Test empty/None UUID
assert analytics.is_uuid_in_percentage("", 50) is False
assert analytics.is_uuid_in_percentage(None, 50) is False
assert is_uuid_in_percentage("", 50) is False
assert is_uuid_in_percentage(None, 50) is False

0 comments on commit 04afb99

Please sign in to comment.