-
Notifications
You must be signed in to change notification settings - Fork 2
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
77a3bb4
commit fdcafeb
Showing
11 changed files
with
481 additions
and
487 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
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,42 @@ | ||
from __future__ import annotations | ||
|
||
import logging | ||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
from coola import objects_are_equal | ||
from coola.testing import xarray_available | ||
from tests.unit.equality.comparators.test_xarray import XARRAY_EQUAL, XARRAY_NOT_EQUAL | ||
|
||
if TYPE_CHECKING: | ||
from tests.unit.equality.comparators.utils import ExamplePair | ||
|
||
|
||
@xarray_available | ||
@pytest.mark.parametrize("example", XARRAY_EQUAL) | ||
@pytest.mark.parametrize("show_difference", [True, False]) | ||
def test_objects_are_equal_true( | ||
example: ExamplePair, show_difference: bool, caplog: pytest.LogCaptureFixture | ||
) -> None: | ||
with caplog.at_level(logging.INFO): | ||
assert objects_are_equal(example.object1, example.object2, show_difference) | ||
assert not caplog.messages | ||
|
||
|
||
@xarray_available | ||
@pytest.mark.parametrize("example", XARRAY_NOT_EQUAL) | ||
def test_objects_are_equal_false(example: ExamplePair, caplog: pytest.LogCaptureFixture) -> None: | ||
with caplog.at_level(logging.INFO): | ||
assert not objects_are_equal(example.object1, example.object2) | ||
assert not caplog.messages | ||
|
||
|
||
@xarray_available | ||
@pytest.mark.parametrize("example", XARRAY_NOT_EQUAL) | ||
def test_objects_are_equal_false_show_difference( | ||
example: ExamplePair, caplog: pytest.LogCaptureFixture | ||
) -> None: | ||
with caplog.at_level(logging.INFO): | ||
assert not objects_are_equal(example.object1, example.object2, show_difference=True) | ||
assert caplog.messages[-1].startswith(example.expected_message) |
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
Oops, something went wrong.