summaryrefslogtreecommitdiff
path: root/tests/unit/test_models.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test_models.py')
-rw-r--r--tests/unit/test_models.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/unit/test_models.py b/tests/unit/test_models.py
index 9a84fa223..c5545e37d 100644
--- a/tests/unit/test_models.py
+++ b/tests/unit/test_models.py
@@ -4,12 +4,13 @@
from pip._vendor.packaging.version import parse as parse_version
from pip._internal.models import candidate, index
+from pip._internal.models.link import Link
class TestPackageIndex:
"""Tests for pip._internal.models.index.PackageIndex"""
- def test_gives_right_urls(self):
+ def test_gives_right_urls(self) -> None:
url = "https://mypypi.internal/path/"
file_storage_domain = "files.mypypi.internal"
pack_index = index.PackageIndex(url, file_storage_domain)
@@ -21,7 +22,7 @@ class TestPackageIndex:
assert pack_index.simple_url == url + "simple"
assert pack_index.pypi_url == url + "pypi"
- def test_PyPI_urls_are_correct(self):
+ def test_PyPI_urls_are_correct(self) -> None:
pack_index = index.PyPI
assert pack_index.netloc == "pypi.org"
@@ -30,7 +31,7 @@ class TestPackageIndex:
assert pack_index.pypi_url == "https://pypi.org/pypi"
assert pack_index.file_storage_domain == "files.pythonhosted.org"
- def test_TestPyPI_urls_are_correct(self):
+ def test_TestPyPI_urls_are_correct(self) -> None:
pack_index = index.TestPyPI
assert pack_index.netloc == "test.pypi.org"
@@ -41,18 +42,18 @@ class TestPackageIndex:
class TestInstallationCandidate:
- def test_sets_correct_variables(self):
+ def test_sets_correct_variables(self) -> None:
obj = candidate.InstallationCandidate(
- "A", "1.0.0", "https://somewhere.com/path/A-1.0.0.tar.gz"
+ "A", "1.0.0", Link("https://somewhere.com/path/A-1.0.0.tar.gz")
)
assert obj.name == "A"
assert obj.version == parse_version("1.0.0")
- assert obj.link == "https://somewhere.com/path/A-1.0.0.tar.gz"
+ assert obj.link.url == "https://somewhere.com/path/A-1.0.0.tar.gz"
# NOTE: This isn't checking the ordering logic; only the data provided to
# it is correct.
- def test_sets_the_right_key(self):
+ def test_sets_the_right_key(self) -> None:
obj = candidate.InstallationCandidate(
- "A", "1.0.0", "https://somewhere.com/path/A-1.0.0.tar.gz"
+ "A", "1.0.0", Link("https://somewhere.com/path/A-1.0.0.tar.gz")
)
assert obj._compare_key == (obj.name, obj.version, obj.link)