Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer actual-expected to expected-actual in assertions #5129

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/console/commands/debug/test_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_debug_resolve_gives_resolution_results(tester: "CommandTester"):
cachy 0.2.0
"""

assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected


def test_debug_resolve_tree_option_gives_the_dependency_tree(tester: "CommandTester"):
Expand All @@ -58,7 +58,7 @@ def test_debug_resolve_tree_option_gives_the_dependency_tree(tester: "CommandTes
└── msgpack-python >=0.5 <0.6
"""

assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected


def test_debug_resolve_git_dependency(tester: "CommandTester"):
Expand All @@ -73,4 +73,4 @@ def test_debug_resolve_git_dependency(tester: "CommandTester"):
demo 0.1.2
"""

assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected
2 changes: 1 addition & 1 deletion tests/console/commands/env/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_env_info_displays_complete_info(tester: "CommandTester"):
Executable: python
"""

assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected


def test_env_info_displays_path_only(tester: "CommandTester"):
Expand Down
6 changes: 3 additions & 3 deletions tests/console/commands/env/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_none_activated(
mocker.patch("poetry.utils.env.EnvManager.get", return_value=env)
tester.execute()
expected = "\n".join(venvs_in_cache_dirs).strip()
assert expected == tester.io.fetch_output().strip()
assert tester.io.fetch_output().strip() == expected


def test_activated(
Expand All @@ -52,10 +52,10 @@ def test_activated(
expected = (
"\n".join(venvs_in_cache_dirs).strip().replace("py3.7", "py3.7 (Activated)")
)
assert expected == tester.io.fetch_output().strip()
assert tester.io.fetch_output().strip() == expected


def test_in_project_venv(tester: "CommandTester", venvs_in_project_dir: List[str]):
tester.execute()
expected = ".venv (Activated)\n"
assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected
10 changes: 5 additions & 5 deletions tests/console/commands/env/test_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_remove_by_python_version(
assert not (venv_cache / f"{venv_name}-py3.6").exists()

expected = f"Deleted virtualenv: {venv_cache / venv_name}-py3.6\n"
assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected


def test_remove_by_name(
Expand All @@ -58,7 +58,7 @@ def test_remove_by_name(

expected += f"Deleted virtualenv: {venv_cache / name}\n"

assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected


def test_remove_all(
Expand All @@ -72,7 +72,7 @@ def test_remove_all(
for name in venvs_in_cache_dirs:
assert not (venv_cache / name).exists()
expected.add(f"Deleted virtualenv: {venv_cache / name}")
assert expected == set(tester.io.fetch_output().split("\n"))
assert set(tester.io.fetch_output().split("\n")) == expected


def test_remove_all_and_version(
Expand All @@ -86,7 +86,7 @@ def test_remove_all_and_version(
for name in venvs_in_cache_dirs:
assert not (venv_cache / name).exists()
expected.add(f"Deleted virtualenv: {venv_cache / name}")
assert expected == set(tester.io.fetch_output().split("\n"))
assert set(tester.io.fetch_output().split("\n")) == expected


def test_remove_multiple(
Expand All @@ -104,4 +104,4 @@ def test_remove_multiple(
expected.add(f"Deleted virtualenv: {venv_cache / name}")
for name in remaining_envs:
assert (venv_cache / name).exists()
assert expected == set(tester.io.fetch_output().split("\n"))
assert set(tester.io.fetch_output().split("\n")) == expected
6 changes: 3 additions & 3 deletions tests/console/commands/env/test_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_activate_activates_non_existing_virtualenv_no_envs_file(
Using virtualenv: {venv_py37}
"""

assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected


def test_get_prefers_explicitly_activated_virtualenvs_over_env_var(
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_get_prefers_explicitly_activated_virtualenvs_over_env_var(
Using virtualenv: {venv_dir}
"""

assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected


def test_get_prefers_explicitly_activated_non_existing_virtualenvs_over_env_var(
Expand Down Expand Up @@ -150,4 +150,4 @@ def test_get_prefers_explicitly_activated_non_existing_virtualenvs_over_env_var(
Using virtualenv: {venv_dir}
"""

assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected
2 changes: 1 addition & 1 deletion tests/console/commands/test_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ def test_about(tester: "CommandTester"):
See https://github.com/python-poetry/poetry for more information.
"""

assert expected == tester.io.fetch_output()
assert tester.io.fetch_output() == expected
Loading