Skip to content

Commit

Permalink
Using re.escape() to escape non-alphanumeric characters in the regex
Browse files Browse the repository at this point in the history
  • Loading branch information
emprzy committed Dec 2, 2024
1 parent a3b5f62 commit 1daed72
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}'."
Expand Down

0 comments on commit 1daed72

Please sign in to comment.