Skip to content

Commit 0862d40

Browse files
committed
(joe) work around no equality operator for requirement objects
1 parent bd87828 commit 0862d40

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/unit/test_req.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,12 @@ def test_parse_editable_local_extras(
662662
def test_get_or_create_caching() -> None:
663663
"""test caching of get_or_create requirement"""
664664
teststr = "affinegap==1.10"
665-
assert get_or_create_requirement(teststr) == Requirement(teststr)
665+
from_helper = get_or_create_requirement(teststr)
666+
freshly_made = Requirement(teststr)
667+
# Requirement doesn't have an equality operator (yet) so test
668+
# equality of attribute for list of attributes
669+
for iattr in ["name", "url", "extras", "specifier", "marker"]:
670+
assert getattr(from_helper, iattr) == getattr(freshly_made, iattr)
666671
assert not (get_or_create_requirement(teststr) is Requirement(teststr))
667672
assert get_or_create_requirement(teststr) is get_or_create_requirement(teststr)
668673

0 commit comments

Comments
 (0)