-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce7cbb3
commit aee199c
Showing
3 changed files
with
69 additions
and
18 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
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
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,45 @@ | ||
"""Unit tests for base configurables.""" | ||
|
||
import pytest | ||
|
||
# Codechecker | ||
from cc_codechecker.configurable import Configurable | ||
|
||
|
||
@pytest.fixture(name='base_configurable') | ||
def fixture_base_configurable() -> Configurable: | ||
return Configurable() | ||
|
||
class VerboseConfigurable(Configurable): | ||
|
||
def __init__(self, **kwargs) -> None: | ||
super().__init__(**kwargs) | ||
|
||
self.verbose = self._locals.verbose | ||
|
||
@pytest.mark.parametrize('value', [True, False]) | ||
def test_verbose_value_set(value: bool): | ||
configurable = VerboseConfigurable(verbose = value) | ||
assert configurable.verbose == value | ||
|
||
def test_repr_nothing(base_configurable: Configurable): | ||
assert str(base_configurable) == 'Configurable()' | ||
|
||
def test_dump_nothing(base_configurable: Configurable): | ||
assert base_configurable.dump() == {} | ||
|
||
class ExampleConfigurable(Configurable): | ||
|
||
def __init__(self, **kwargs) -> None: | ||
super().__init__(**kwargs) | ||
self.example = True | ||
|
||
@pytest.fixture(name='example_configurable') | ||
def fixture_example_configurable() -> Configurable: | ||
return ExampleConfigurable() | ||
|
||
def test_repr_something(example_configurable: ExampleConfigurable): | ||
assert str(example_configurable) == 'ExampleConfigurable(example=True)' | ||
|
||
def test_dump_something(example_configurable: ExampleConfigurable): | ||
assert example_configurable.dump() == { 'example': True } |