Skip to content

Commit 1ad6dd8

Browse files
committed
Fix coverage: exercise __gt__ cached-key branch
1 parent 1334da7 commit 1ad6dd8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/test_version.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,14 @@ def test_base_version_ne_with_base_version(self) -> None:
895895
v2 = SimpleVersion("2.0")
896896
assert v1 != v2
897897

898+
def test_gt_with_cached_other(self) -> None:
899+
"""__gt__ fast path when other already has a cached key."""
900+
other = Version("1.0")
901+
# Pre-populate other's key cache via a comparison.
902+
_ = other < Version("2.0")
903+
# Now a fresh version calls __gt__ with a pre-cached other.
904+
assert Version("2.0") > other
905+
898906
def test_version_compare_with_base_version_subclass(self) -> None:
899907
"""Test Version comparison with another _BaseVersion subclass"""
900908
v1 = Version("1.0")

0 commit comments

Comments
 (0)