mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-11 23:34:17 +00:00
add a __repr__ for JobsArgument
This commit is contained in:
parent
b454674b27
commit
0698366a20
2 changed files with 10 additions and 0 deletions
|
|
@ -80,6 +80,10 @@ class JobsArgument:
|
||||||
f"{arg!r} must be 'auto' or an integer.",
|
f"{arg!r} must be 'auto' or an integer.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
"""Representation for debugging."""
|
||||||
|
return f"{type(self).__name__}({str(self)!r})"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Format our JobsArgument class."""
|
"""Format our JobsArgument class."""
|
||||||
return "auto" if self.is_auto else str(self.n_jobs)
|
return "auto" if self.is_auto else str(self.n_jobs)
|
||||||
|
|
|
||||||
|
|
@ -387,3 +387,9 @@ def test_jobs_argument_str():
|
||||||
"""Test that JobsArgument has a correct __str__."""
|
"""Test that JobsArgument has a correct __str__."""
|
||||||
assert str(JobsArgument("auto")) == "auto"
|
assert str(JobsArgument("auto")) == "auto"
|
||||||
assert str(JobsArgument("123")) == "123"
|
assert str(JobsArgument("123")) == "123"
|
||||||
|
|
||||||
|
|
||||||
|
def test_jobs_argument_repr():
|
||||||
|
"""Test that JobsArgument has a correct __repr__."""
|
||||||
|
assert repr(JobsArgument("auto")) == "JobsArgument('auto')"
|
||||||
|
assert repr(JobsArgument("123")) == "JobsArgument('123')"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue