Skip to content

Commit d611e4d

Browse files
committed
test: add unit tests for _version_info comparisons
1 parent a122c7e commit d611e4d

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

tests/test_main.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,39 @@ def test_check_env(monkeypatch):
4545
check_env()
4646

4747

48+
def test_version_info_comparisons():
49+
"""Test _version_info comparison operators with tuples and other instances."""
50+
v3_10 = _version_info(3, 10)
51+
v3_9 = _version_info(3, 9)
52+
v3_11 = _version_info(3, 11)
53+
54+
# Test __eq__ with tuples
55+
assert v3_10 == (3, 10)
56+
assert v3_10 != (3, 9)
57+
assert v3_9 == (3, 9)
58+
59+
# Test __ge__ with tuples
60+
assert v3_10 >= (3, 10)
61+
assert v3_10 >= (3, 9)
62+
assert not (v3_9 >= (3, 10))
63+
assert v3_11 >= (3, 10)
64+
65+
# Test __eq__ with other _version_info instances
66+
assert v3_10 == _version_info(3, 10)
67+
assert v3_10 != v3_9
68+
assert v3_10 == v3_10 # Same instance
69+
70+
assert v3_10 != v3_11
71+
72+
# Test __ge__ with other _version_info instances
73+
assert v3_10 >= v3_10
74+
assert v3_10 >= v3_9
75+
assert not (v3_9 >= v3_10)
76+
assert v3_11 >= v3_10
77+
78+
assert v3_11 >= v3_11 # Same instance
79+
80+
4881
@pytest.mark.asyncio
4982
async def test_check_dashboard_files_not_exists(monkeypatch):
5083
"""Tests dashboard download when files do not exist."""

0 commit comments

Comments
 (0)