Skip to content

Commit

Permalink
Separate tests comparing objects to markers and requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Mar 15, 2022
1 parent b7008af commit a157714
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions tests/test_markers.py
Expand Up @@ -241,11 +241,13 @@ def test_different_markers_different_hashes(self, example1, example2):
marker1, marker2 = Marker(example1), Marker(example2)
# Markers created from strings that are not equivalent should differ.
assert marker1 != marker2
# Markers should not be comparable with other kinds of objects.
assert marker1 != example1
# Different Marker objects should have different hashes.
assert hash(marker1) != hash(marker2)

def test_compare_markers_to_other_objects(self):
# Markers should not be comparable to other kinds of objects.
assert Marker("os_name == 'nt'") != "os_name == 'nt'"

def test_extra_with_no_extra_in_environment(self):
# We can't evaluate an extra if no extra is passed into the environment
m = Marker("extra == 'security'")
Expand Down
7 changes: 4 additions & 3 deletions tests/test_requirements.py
Expand Up @@ -243,8 +243,9 @@ def test_different_reqs_different_hashes(self, dep1, dep2):
# Requirement objects created from non-equivalent strings should differ.
req1, req2 = Requirement(dep1), Requirement(dep2)
assert req1 != req2
# Requirement objects should not be comparable with other kinds of objects.
assert req1 != dep1
assert req2 != dep2
# Different Requirement objects should have different hashes.
assert hash(req1) != hash(req2)

def test_compare_reqs_to_other_objects(self):
# Requirement objects should not be comparable to other kinds of objects.
assert Requirement("packaging>=21.3") != "packaging>=21.3"

0 comments on commit a157714

Please sign in to comment.