From 04afb99c5490ea169d006f2f6e636c7447946b60 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 17 Dec 2024 13:33:33 -0800 Subject: [PATCH] fix: Use module-level function in test_is_uuid_in_percentage --- tests/basic/test_analytics.py | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/basic/test_analytics.py b/tests/basic/test_analytics.py index 98aa1d44068..b800b33562d 100644 --- a/tests/basic/test_analytics.py +++ b/tests/basic/test_analytics.py @@ -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