-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from hechth/50_eq_computation
Implemented __eq__ function for Kovats and CubicSpline via ComputationMethod class
- Loading branch information
Showing
4 changed files
with
31 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import logging | ||
|
||
from .ComputationMethod import ComputationMethod | ||
from .CubicSpline import CubicSpline | ||
from .Kovats import Kovats | ||
|
||
logging.getLogger(__name__).addHandler(logging.NullHandler()) | ||
|
||
__all__ = [ | ||
"ComputationMethod", | ||
"CubicSpline", | ||
"Kovats", | ||
] |
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,24 @@ | ||
import pytest | ||
|
||
from RIAssigner.compute import ComputationMethod, CubicSpline, Kovats | ||
|
||
|
||
@pytest.mark.parametrize('this, other, expected', [ | ||
[CubicSpline(), CubicSpline(), True], | ||
[Kovats(), Kovats(), True], | ||
[CubicSpline(), Kovats(), False], | ||
[Kovats(), object(), False], | ||
[CubicSpline(), object(), False], | ||
]) | ||
def test_equal(this, other, expected): | ||
actual = (this == other) | ||
assert actual == expected | ||
|
||
|
||
def test_abc(): | ||
with pytest.raises(TypeError) as exception: | ||
method = ComputationMethod() | ||
|
||
message = exception.value.args[0] | ||
assert exception.typename == "TypeError" | ||
assert str(message).startswith("Can't instantiate abstract class ComputationMethod with abstract methods") |