From 396ced783cb1c19185d0359911a5ddc9e038caee Mon Sep 17 00:00:00 2001 From: Johannes Kasimir Date: Fri, 7 Aug 2026 14:59:49 +0200 Subject: [PATCH] fix: warning message --- src/plopp/plotting/common.py | 2 +- tests/plotting/common_test.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plopp/plotting/common.py b/src/plopp/plotting/common.py index aab49e7d6..60d18fea1 100644 --- a/src/plopp/plotting/common.py +++ b/src/plopp/plotting/common.py @@ -247,7 +247,7 @@ def _check_coord_sanity(da: sc.DataArray) -> None: 'The input contains a coordinate with unsorted values ' f'({name}). The results may be unpredictable. ' 'Coordinates can be sorted using ' - '`scipp.sort(data, dim="to_be_sorted", order="ascending")`.', + '`scipp.sort(data, key="to_be_sorted", order="ascending")`.', RuntimeWarning, stacklevel=2, ) diff --git a/tests/plotting/common_test.py b/tests/plotting/common_test.py index 68648e3aa..bc4a2ab52 100644 --- a/tests/plotting/common_test.py +++ b/tests/plotting/common_test.py @@ -37,7 +37,11 @@ def test_preprocess_warns_when_coordinate_is_not_sorted(): da = data_array(ndim=1) unsorted = sc.concat([da['xx', 20:], da['xx', :20]], dim='xx') with pytest.warns( - RuntimeWarning, match='The input contains a coordinate with unsorted values' + RuntimeWarning, + match=( + r'The input contains a coordinate with unsorted values.*' + r'scipp\.sort\(data, key="to_be_sorted", order="ascending"\)' + ), ): preprocess(unsorted)