Style fixes
This commit is contained in:
parent
8fd5f573b1
commit
9ed45eebcd
@ -152,8 +152,7 @@
|
|||||||
r"(})?" # finish format string with non-escaped close brace }, or missing if not present
|
r"(})?" # finish format string with non-escaped close brace }, or missing if not present
|
||||||
r"|"
|
r"|"
|
||||||
# OPTION 3: mismatched close brace (option 2 would consume a matched open brace)
|
# OPTION 3: mismatched close brace (option 2 would consume a matched open brace)
|
||||||
r"(})" # brace
|
r"(})" r")", # brace
|
||||||
r")",
|
|
||||||
re.IGNORECASE,
|
re.IGNORECASE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -810,13 +810,10 @@ def test_version_list_with_range_and_concrete_version_is_not_concrete():
|
|||||||
v = VersionList([Version("3.1"), VersionRange(Version("3.1.1"), Version("3.1.2"))])
|
v = VersionList([Version("3.1"), VersionRange(Version("3.1.1"), Version("3.1.2"))])
|
||||||
assert not v.concrete
|
assert not v.concrete
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"pre_equal, post_equal", (
|
"pre_equal, post_equal",
|
||||||
("foo", "develop"),
|
(("foo", "develop"), ("a" * 40, "develop"), ("a" * 40, None), ("v1.2.0", "1.2.0")),
|
||||||
("a"*40, "develop"),
|
|
||||||
("a"*40, None),
|
|
||||||
("v1.2.0", "1.2.0")
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
def test_git_versions_store_ref_requests(pre_equal, post_equal):
|
def test_git_versions_store_ref_requests(pre_equal, post_equal):
|
||||||
"""
|
"""
|
||||||
@ -840,6 +837,7 @@ def test_git_versions_store_ref_requests(pre_equal, post_equal):
|
|||||||
if v.is_commit:
|
if v.is_commit:
|
||||||
assert v.ref == v.commit_sha
|
assert v.ref == v.commit_sha
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"vstring, eq_vstring, is_commit",
|
"vstring, eq_vstring, is_commit",
|
||||||
(
|
(
|
||||||
|
@ -551,13 +551,12 @@ class GitVersion(ConcreteVersion):
|
|||||||
__slots__ = ["has_git_prefix", "commit_sha", "ref", "std_version", "_ref_lookup"]
|
__slots__ = ["has_git_prefix", "commit_sha", "ref", "std_version", "_ref_lookup"]
|
||||||
|
|
||||||
def __init__(self, string: str):
|
def __init__(self, string: str):
|
||||||
|
|
||||||
# TODO will be required for concrete specs when commit lookup added
|
# TODO will be required for concrete specs when commit lookup added
|
||||||
self.commit_sha: Optional[String] = None
|
self.commit_sha: Optional[str] = None
|
||||||
self.std_version: Optional[StandardVersion] = None
|
self.std_version: Optional[StandardVersion] = None
|
||||||
|
|
||||||
# optional user supplied git ref
|
# optional user supplied git ref
|
||||||
self.ref: Optional[String] = None
|
self.ref: Optional[str] = None
|
||||||
|
|
||||||
# An object that can lookup git refs to compare them to versions
|
# An object that can lookup git refs to compare them to versions
|
||||||
self._ref_lookup: Optional[AbstractRefLookup] = None
|
self._ref_lookup: Optional[AbstractRefLookup] = None
|
||||||
@ -638,7 +637,9 @@ def satisfies(self, other: VersionType) -> bool:
|
|||||||
raise TypeError(f"'satisfies()' not supported for instances of {type(other)}")
|
raise TypeError(f"'satisfies()' not supported for instances of {type(other)}")
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
s = f"git.{self.ref}" if self.has_git_prefix else self.ref
|
s = ""
|
||||||
|
if self.ref:
|
||||||
|
s += f"git.{self.ref}" if self.has_git_prefix else self.ref
|
||||||
# Note: the solver actually depends on str(...) to produce the effective version.
|
# Note: the solver actually depends on str(...) to produce the effective version.
|
||||||
# So when a lookup is attached, we require the resolved version to be printed.
|
# So when a lookup is attached, we require the resolved version to be printed.
|
||||||
# But for standalone git versions that don't have a repo attached, it would still
|
# But for standalone git versions that don't have a repo attached, it would still
|
||||||
@ -660,6 +661,7 @@ def __eq__(self, other: object) -> bool:
|
|||||||
return (
|
return (
|
||||||
isinstance(other, GitVersion)
|
isinstance(other, GitVersion)
|
||||||
and self.ref == other.ref
|
and self.ref == other.ref
|
||||||
|
# TODO(psakiev) this needs to chamge to commits when we turn on lookups
|
||||||
and self.ref_version == other.ref_version
|
and self.ref_version == other.ref_version
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user