Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkuo authored and neersighted committed Jun 21, 2022
1 parent d916cc9 commit 936a0fd
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions tests/packages/test_locker.py
Expand Up @@ -17,7 +17,7 @@
from poetry.core.semver.version import Version

from poetry.factory import Factory
from poetry.packages.locker import Locker
from poetry.packages.locker import Locker, GENERATED_COMMENT
from tests.helpers import get_dependency
from tests.helpers import get_package

Expand Down Expand Up @@ -81,8 +81,8 @@ def test_lock_file_data_is_ordered(locker: Locker, root: ProjectPackage):
with locker.lock.open(encoding="utf-8") as f:
content = f.read()

expected = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
expected = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "A"
Expand Down Expand Up @@ -157,9 +157,9 @@ def test_lock_file_data_is_ordered(locker: Locker, root: ProjectPackage):
[metadata.files]
A = [
{file = "bar", hash = "123"},
{file = "foo", hash = "456"},
{file = "baz", hash = "345"},
{{file = "bar", hash = "123"}},
{{file = "foo", hash = "456"}},
{{file = "baz", hash = "345"}},
]
B = []
git-package = []
Expand All @@ -170,8 +170,8 @@ def test_lock_file_data_is_ordered(locker: Locker, root: ProjectPackage):


def test_locker_properly_loads_extras(locker: Locker):
content = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
content = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "cachecontrol"
Expand Down Expand Up @@ -217,8 +217,8 @@ def test_locker_properly_loads_extras(locker: Locker):


def test_locker_properly_loads_nested_extras(locker: Locker):
content = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
content = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "a"
Expand All @@ -229,7 +229,7 @@ def test_locker_properly_loads_nested_extras(locker: Locker):
python-versions = "*"
[package.dependencies]
b = {version = "^1.0", optional = true, extras = "c"}
b = {{version = "^1.0", optional = true, extras = "c"}}
[package.extras]
b = ["b[c] (>=1.0,<2.0)"]
Expand All @@ -243,7 +243,7 @@ def test_locker_properly_loads_nested_extras(locker: Locker):
python-versions = "*"
[package.dependencies]
c = {version = "^1.0", optional = true}
c = {{version = "^1.0", optional = true}}
[package.extras]
c = ["c (>=1.0,<2.0)"]
Expand Down Expand Up @@ -299,8 +299,8 @@ def test_locker_properly_loads_nested_extras(locker: Locker):


def test_locker_properly_loads_extras_legacy(locker: Locker):
content = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
content = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "a"
Expand All @@ -311,7 +311,7 @@ def test_locker_properly_loads_extras_legacy(locker: Locker):
python-versions = "*"
[package.dependencies]
b = {version = "^1.0", optional = true}
b = {{version = "^1.0", optional = true}}
[package.extras]
b = ["b (^1.0)"]
Expand Down Expand Up @@ -359,8 +359,8 @@ def test_lock_packages_with_null_description(locker: Locker, root: ProjectPackag
with locker.lock.open(encoding="utf-8") as f:
content = f.read()

expected = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
expected = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "A"
Expand Down Expand Up @@ -393,8 +393,8 @@ def test_lock_file_should_not_have_mixed_types(locker: Locker, root: ProjectPack

locker.set_lock_data(root, [package_a])

expected = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
expected = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "A"
Expand All @@ -406,8 +406,8 @@ def test_lock_file_should_not_have_mixed_types(locker: Locker, root: ProjectPack
[package.dependencies]
B = [
{version = "^1.0.0"},
{version = ">=1.0.0", optional = true},
{{version = "^1.0.0"}},
{{version = ">=1.0.0", optional = true}},
]
[package.extras]
Expand All @@ -429,8 +429,8 @@ def test_lock_file_should_not_have_mixed_types(locker: Locker, root: ProjectPack


def test_reading_lock_file_should_raise_an_error_on_invalid_data(locker: Locker):
content = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
content = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "A"
Expand Down Expand Up @@ -480,8 +480,8 @@ def test_locking_legacy_repository_package_should_include_source_section(
with locker.lock.open(encoding="utf-8") as f:
content = f.read()

expected = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
expected = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "A"
Expand Down Expand Up @@ -542,8 +542,8 @@ def test_locker_should_emit_warnings_if_lock_version_is_newer_but_allowed(
def test_locker_should_raise_an_error_if_lock_version_is_newer_and_not_allowed(
locker: Locker, caplog: LogCaptureFixture
):
content = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
content = f"""\
# {GENERATED_COMMENT}
[metadata]
lock-version = "2.0"
Expand Down Expand Up @@ -571,8 +571,8 @@ def test_extras_dependencies_are_ordered(locker: Locker, root: ProjectPackage):

locker.set_lock_data(root, [package_a])

expected = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
expected = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "A"
Expand All @@ -583,7 +583,7 @@ def test_extras_dependencies_are_ordered(locker: Locker, root: ProjectPackage):
python-versions = "*"
[package.dependencies]
B = {version = "^1.0.0", extras = ["a", "b", "c"], optional = true}
B = {{version = "^1.0.0", extras = ["a", "b", "c"], optional = true}}
[metadata]
lock-version = "1.1"
Expand Down Expand Up @@ -664,7 +664,7 @@ def test_locker_dumps_dependency_information_correctly(
with locker.lock.open(encoding="utf-8") as f:
content = f.read()

expected = """# This file is automatically @generated by Poetry and should not be changed by hand.
expected = f"""# {GENERATED_COMMENT}
[[package]]
name = "A"
Expand All @@ -675,11 +675,11 @@ def test_locker_dumps_dependency_information_correctly(
python-versions = "*"
[package.dependencies]
B = {path = "project_with_extras", develop = true}
C = {path = "directory/project_with_transitive_directory_dependencies"}
D = {path = "distributions/demo-0.1.0.tar.gz"}
E = {url = "https://python-poetry.org/poetry-1.2.0.tar.gz"}
F = {git = "https://github.com/python-poetry/poetry.git", branch = "foo"}
B = {{path = "project_with_extras", develop = true}}
C = {{path = "directory/project_with_transitive_directory_dependencies"}}
D = {{path = "distributions/demo-0.1.0.tar.gz"}}
E = {{url = "https://python-poetry.org/poetry-1.2.0.tar.gz"}}
F = {{git = "https://github.com/python-poetry/poetry.git", branch = "foo"}}
[metadata]
lock-version = "1.1"
Expand All @@ -696,8 +696,8 @@ def test_locker_dumps_dependency_information_correctly(
def test_locked_repository_uses_root_dir_of_package(
locker: Locker, mocker: MockerFixture
):
content = """\
# This file is automatically @generated by Poetry and should not be changed by hand.
content = f"""\
# {GENERATED_COMMENT}
[[package]]
name = "lib-a"
Expand All @@ -709,7 +709,7 @@ def test_locked_repository_uses_root_dir_of_package(
develop = true
[package.dependencies]
lib-b = {path = "../libB", develop = true}
lib-b = {{path = "../libB", develop = true}}
[package.source]
type = "directory"
Expand Down

0 comments on commit 936a0fd

Please sign in to comment.