Skip to content

Commit

Permalink
consistent representations
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Jul 20, 2024
1 parent f42758e commit 5827647
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/poetry/core/constraints/generic/constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def __hash__(self) -> int:
return hash((self._operator, self._value))

def __str__(self) -> str:
space = " " if self._operator in {"in", "not in"} else ""
if self._operator in {"in", "not in"}:
return f"'{self._value}' {self._operator}"
op = self._operator if self._operator != "==" else ""
return f"{op}{space}{self._value}"
return f"{op}{self._value}"
4 changes: 2 additions & 2 deletions tests/version/test_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def test_parse_marker(marker: str) -> None:
"platform_machine",
"!=aarch64, !=loongarch64",
),
('"tegra" not in platform_release', "platform_release", "not in tegra"),
('"rpi-v8" in platform_release', "platform_release", "in rpi-v8"),
('"tegra" not in platform_release', "platform_release", "'tegra' not in"),
('"rpi-v8" in platform_release', "platform_release", "'rpi-v8' in"),
],
)
def test_parse_single_marker(
Expand Down

0 comments on commit 5827647

Please sign in to comment.