-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated minxins File & Added corresponding Tests as well tests_minxin
- Loading branch information
1 parent
cfc9e1f
commit dd6163a
Showing
2 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
from xcov19.utils.mixins import InterfaceProtocolCheckMixin | ||
|
||
|
||
class BaseClass: | ||
@classmethod | ||
def method_with_params(cls, param1: int, param2: str) -> None: | ||
pass | ||
|
||
|
||
def test_incorrect_implementation_missing_method(): | ||
# Define IncorrectImplementation inside the test function | ||
try: | ||
|
||
class IncorrectImplementation(BaseClass, InterfaceProtocolCheckMixin): | ||
"""Does not implement method_with_params""" | ||
|
||
pass | ||
|
||
IncorrectImplementation() | ||
|
||
except NotImplementedError as exec: | ||
assert ( | ||
str(exec) | ||
== "The method 'method_with_params' is inherited from the parent class 'BaseClass' and not overridden/declared." | ||
) | ||
|
||
|
||
def test_correct_implementation(): | ||
class CorrectImplementation(BaseClass, InterfaceProtocolCheckMixin): | ||
@classmethod | ||
def method_with_params(cls, param1: int, param2: str) -> None: | ||
pass | ||
|
||
try: | ||
instance = CorrectImplementation() | ||
instance.method_with_params(1, "test") | ||
assert True | ||
except Exception as e: | ||
pytest.fail(f"CorrectImplementation raised an exception: {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters