-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershacktoberfest
Description
crepr add tests/classes/*.py --diff
should produce:
diff --git a/tests/classes/class_without_repr.py b/tests/classes/class_without_repr.py
index e98cb0b..bb19906 100644
--- a/tests/classes/class_without_repr.py
+++ b/tests/classes/class_without_repr.py
@@ -12,3 +12,9 @@ class MyClassWithoutRepr:
def __init__(self: Self, value: str) -> None:
"""Initialize the class with the given value."""
self.value = value
+
+ def __repr__(self) -> str:
+ """Create a string (c)representation for MyClassWithoutRepr."""
+ return (f'{self.__class__.__module__}.{self.__class__.__name__}('
+ f'value={self.value!r}, '
+ ')')
diff --git a/tests/classes/existing_repr_test.py b/tests/classes/existing_repr_test.py
index 004e416..1beb132 100644
--- a/tests/classes/existing_repr_test.py
+++ b/tests/classes/existing_repr_test.py
@@ -23,6 +23,13 @@ class NoRepr:
"""Initialize the class."""
self.name = name
+ def __repr__(self) -> str:
+ """Create a string (c)representation for NoRepr."""
+ return (f'{self.__class__.__module__}.{self.__class__.__name__}('
+ f'name={self.name!r}, '
+ ')')
+
+
@dataclasses.dataclass
class TestDataClass:
@@ -35,4 +42,4 @@ class TestDataClass:
class TestDataClassFrozen:
"""A simple frozen dataclass for testing ignore existing flag."""
- number: int
+ number: int
\ No newline at end of file
diff --git a/tests/classes/kw_only_test.py b/tests/classes/kw_only_test.py
index 72565b3..79733cf 100644
--- a/tests/classes/kw_only_test.py
+++ b/tests/classes/kw_only_test.py
@@ -10,3 +10,10 @@ class KwOnly:
"""Initialize the class."""
self.name = name # pragma: no cover
self.age = age # pragma: no cover
+
+ def __repr__(self) -> str:
+ """Create a string (c)representation for KwOnly."""
+ return (f'{self.__class__.__module__}.{self.__class__.__name__}('
+ f'name={self.name!r}, '
+ f'age={self.age!r}, '
+ ')')
diff --git a/tests/classes/splat_kwargs_test.py b/tests/classes/splat_kwargs_test.py
index 0584692..8e766a6 100644
--- a/tests/classes/splat_kwargs_test.py
+++ b/tests/classes/splat_kwargs_test.py
@@ -10,3 +10,10 @@ class SplatKwargs:
"""Initialize the class."""
self.name = name # pragma: no cover
self.kwargs = kwargs # pragma: no cover
+
+ def __repr__(self) -> str:
+ """Create a string (c)representation for SplatKwargs."""
+ return (f'{self.__class__.__module__}.{self.__class__.__name__}('
+ f'name={self.name!r}, '
+ f'**{},'
+ ')')and crepr remove tests/classes/*.py --diff
diff --git a/tests/classes/class_with_repr_test.py b/tests/classes/class_with_repr_test.py
index 334e901..5de1dfc 100644
--- a/tests/classes/class_with_repr_test.py
+++ b/tests/classes/class_with_repr_test.py
@@ -12,11 +12,3 @@ class MyClassWithRepr:
def __init__(self: Self, value: str) -> None:
"""Initialize the class with the given value."""
self.value = value
-
- def __repr__(self: Self) -> str:
- """Create a string (c)representation for MyClassWithRepr."""
- return (
- f"{self.__class__.__module__}.{self.__class__.__name__}("
- f"value={self.value!r}, "
- ")"
- )
diff --git a/tests/classes/class_without_repr.py b/tests/classes/class_without_repr.py
index e98cb0b..b3a35cb 100644
--- a/tests/classes/class_without_repr.py
+++ b/tests/classes/class_without_repr.py
@@ -11,4 +11,4 @@ class MyClassWithoutRepr:
def __init__(self: Self, value: str) -> None:
"""Initialize the class with the given value."""
- self.value = value
+ self.value = value
\ No newline at end of file
diff --git a/tests/classes/existing_repr_test.py b/tests/classes/existing_repr_test.py
index 004e416..a03e6b8 100644
--- a/tests/classes/existing_repr_test.py
+++ b/tests/classes/existing_repr_test.py
@@ -11,9 +11,6 @@ class ExistingRepr:
"""Initialize the class."""
self.name = name
- def __repr__(self: Self) -> str:
- """Existing repr magic method of the class."""
- return f"ExistingRepr(name={self.name!r})"
class NoRepr:
@@ -35,4 +32,4 @@ class TestDataClass:
class TestDataClassFrozen:
"""A simple frozen dataclass for testing ignore existing flag."""
- number: int
+ number: int
\ No newline at end of file
diff --git a/tests/classes/kw_only_test.py b/tests/classes/kw_only_test.py
index 72565b3..7c37b74 100644
--- a/tests/classes/kw_only_test.py
+++ b/tests/classes/kw_only_test.py
@@ -9,4 +9,4 @@ class KwOnly:
def __init__(self: Self, name: str, *, age: int) -> None:
"""Initialize the class."""
self.name = name # pragma: no cover
- self.age = age # pragma: no cover
+ self.age = age # pragma: no cover
\ No newline at end of file
diff --git a/tests/classes/splat_kwargs_test.py b/tests/classes/splat_kwargs_test.py
index 0584692..3cec523 100644
--- a/tests/classes/splat_kwargs_test.py
+++ b/tests/classes/splat_kwargs_test.py
@@ -9,4 +9,4 @@ class SplatKwargs:
def __init__(self: Self, name: str, **kwargs: int) -> None:
"""Initialize the class."""
self.name = name # pragma: no cover
- self.kwargs = kwargs # pragma: no cover
+ self.kwargs = kwargs # pragma: no cover
\ No newline at end of fileNnot sure if all of the above is needed, the diff was created by applying the changes and using git--diff
I am not sure if e.g: \ No newline at end of file and index 72565b3..7c37b74 100644, etc. is needed.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershacktoberfest