-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw a KeyError exception if obsolete names are used
- Loading branch information
Showing
8 changed files
with
1,823 additions
and
1,697 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,44 @@ | ||
"""Test suite for data_vector module""" | ||
|
||
# pylint: disable=too-few-public-methods,invalid-name,too-many-lines | ||
|
||
import pytest | ||
from luxtronik.data_vector import DataVector | ||
|
||
from luxtronik.datatypes import ( | ||
Base, | ||
) | ||
|
||
|
||
class ObsoleteDataVector(DataVector): | ||
|
||
name = "Obsolete" | ||
|
||
_obsolete = { | ||
"baz": "foo" | ||
} | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self._data = { | ||
0: Base(["foo", "bar"]), | ||
} | ||
|
||
|
||
class TestDataVector: | ||
"""Test suite for DataVector""" | ||
|
||
@pytest.mark.parametrize("name, exception_expected", [ | ||
("foo", False), | ||
("bar", True), | ||
("baz", True), | ||
("qux", False), | ||
]) | ||
def test_obsolete(self, name, exception_expected): | ||
"""Test cases for initialization""" | ||
obsolete = ObsoleteDataVector() | ||
try: | ||
obsolete.get(name) | ||
assert not exception_expected | ||
except KeyError: | ||
assert exception_expected |
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