Skip to content

Commit 47b986d

Browse files
committed
PR #777 minor copy finetuning
1 parent d622689 commit 47b986d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- `openeo.testing.io.TestDataLoader`: unit test utility to compactly load (and optionally preprocess) tests data (text/JSON/...)
1313
- `openeo.Connection`: automatically retry API requests on `429 Too Many Requests` HTTP errors, with appropriate delay if possible ([#441](https://github.com/Open-EO/openeo-python-client/issues/441))
14-
- Introduced the `pixel_tolerance` variable in `openeo.testing.results` to specify the allowable percentage of differing pixels in the results.
14+
- Introduced `pixel_tolerance` argument in `openeo.testing.results` helpers to specify the ignorable fraction of significantly differing pixels. ([#776](https://github.com/Open-EO/openeo-python-client/issues/776))
1515

1616
### Changed
1717

openeo/testing/results.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def _compare_xarray_dataarray(
239239
percentage_bad_pixels = bad_pixels.mean().item() * 100
240240
assert (
241241
percentage_bad_pixels <= pixel_tolerance
242-
), f"{percentage_bad_pixels:.3f}% of pixels that are different and this is above the threshold of {pixel_tolerance:.3f}%"
242+
), f"Fraction significantly differing pixels: {percentage_bad_pixels}% > {pixel_tolerance}%"
243243
xarray.testing.assert_allclose(
244244
a=actual.where(~bad_pixels), b=expected.where(~bad_pixels), rtol=rtol, atol=atol
245245
)
@@ -497,7 +497,8 @@ def assert_job_results_allclose(
497497
:py:meth:`~openeo.rest.job.JobResults` object or path to directory with downloaded assets.
498498
:param rtol: relative tolerance
499499
:param atol: absolute tolerance
500-
:param pixel_tolerance: maximum fraction of pixels (in percent) that is allowed to be different (considering ``atol`` and ``rtol``)
500+
:param pixel_tolerance: maximum fraction of pixels (in percent)
501+
that is allowed to be significantly different (considering ``atol`` and ``rtol``)
501502
:param tmp_path: root temp path to download results if needed.
502503
It's recommended to pass pytest's `tmp_path` fixture here
503504
:raises AssertionError: if not equal within the given tolerance

tests/testing/test_results.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ def test_simple_atol(self, actual, atol, expected_issues):
162162
21,
163163
[
164164
dirty_equals.IsStr(
165-
regex=r"40.000% of pixels that are different and this is above the threshold of 21.000%",
166-
regex_flags=re.DOTALL,
165+
regex=r"Fraction significantly differing pixels: 40.0% > 21%",
167166
)
168167
],
169168
),

0 commit comments

Comments
 (0)