summaryrefslogtreecommitdiff
path: root/pkg_resources/tests/test_resources.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2019-10-27 18:41:13 -0400
committerGitHub <noreply@github.com>2019-10-27 18:41:13 -0400
commit2d89c5d7d06ce07864e6e28c70853066966cf89f (patch)
tree1b1bed55dea7e7ee23d21f6154d648421a9fe64f /pkg_resources/tests/test_resources.py
parent85069ea5aea84e6a6d2e56a1327c0d17635421cd (diff)
parentb03652f642a8ea04644eb7d5b38223148dea5611 (diff)
downloadpython-setuptools-git-2d89c5d7d06ce07864e6e28c70853066966cf89f.tar.gz
Merge pull request #1814 from benoit-pierre/fix_requirement_hash/equality
pkg_resources: fix ``Requirement`` hash/equality implementation
Diffstat (limited to 'pkg_resources/tests/test_resources.py')
-rw-r--r--pkg_resources/tests/test_resources.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 7063ed3d..93fa7114 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -520,6 +520,11 @@ class TestRequirements:
assert r1 == r2
assert str(r1) == str(r2)
assert str(r2) == "Twisted==1.2c1,>=1.2"
+ assert (
+ Requirement("Twisted")
+ !=
+ Requirement("Twisted @ https://localhost/twisted.zip")
+ )
def testBasicContains(self):
r = Requirement("Twisted>=1.2")
@@ -546,11 +551,23 @@ class TestRequirements:
==
hash((
"twisted",
+ None,
packaging.specifiers.SpecifierSet(">=1.2"),
frozenset(["foo", "bar"]),
None
))
)
+ assert (
+ hash(Requirement.parse("Twisted @ https://localhost/twisted.zip"))
+ ==
+ hash((
+ "twisted",
+ "https://localhost/twisted.zip",
+ packaging.specifiers.SpecifierSet(),
+ frozenset(),
+ None
+ ))
+ )
def testVersionEquality(self):
r1 = Requirement.parse("foo==0.3a2")