From 1daed72da55c2a9f09880bb75064221e3503a0f3 Mon Sep 17 00:00:00 2001 From: Emily Przykucki Date: Mon, 2 Dec 2024 14:41:03 -0500 Subject: [PATCH] Using re.escape() to escape non-alphanumeric characters in the regex --- flepimop/gempyor_pkg/tests/statistics/test_statistic_class.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flepimop/gempyor_pkg/tests/statistics/test_statistic_class.py b/flepimop/gempyor_pkg/tests/statistics/test_statistic_class.py index 274a344bf..bc2007270 100644 --- a/flepimop/gempyor_pkg/tests/statistics/test_statistic_class.py +++ b/flepimop/gempyor_pkg/tests/statistics/test_statistic_class.py @@ -8,6 +8,7 @@ import pytest import scipy import xarray as xr +import re from gempyor.statistics import Statistic from gempyor.testing import create_confuse_configview_from_dict @@ -520,7 +521,7 @@ def test_compute_logloss_data_misshape_value_error( model_rows, model_cols = mock_inputs.model_data[mock_inputs.config["sim_var"]].shape gt_rows, gt_cols = mock_inputs.gt_data[mock_inputs.config["data_var"]].shape - expected_match = ( + expected_match = re.escape( rf"`model_data` and `gt_data` do not have the same shape: " rf"`model_data.shape` = '{mock_inputs.model_data[mock_inputs.config['sim_var']].shape}' " rf"!= `gt_data.shape` = '{mock_inputs.gt_data[mock_inputs.config['data_var']].shape}'."