fixes error with escape character in regex

This commit is contained in:
onyx-and-iris 2023-08-13 18:16:49 +01:00
parent 753714b639
commit 36692d1bc7

View File

@ -1,3 +1,5 @@
import re
import pytest import pytest
import vban_cmd import vban_cmd
@ -15,16 +17,15 @@ class TestErrors:
vban_cmd.api("unknown_kind") vban_cmd.api("unknown_kind")
def test_it_tests_an_unknown_config_name(self): def test_it_tests_an_unknown_config_name(self):
EXPECTED_MSG = ( EXPECTED_MSG = "\n".join(
(
f"No config with name 'unknown' is loaded into memory", f"No config with name 'unknown' is loaded into memory",
f"Known configs: {list(vban.configs.keys())}", f"Known configs: {list(vban.configs.keys())}",
) )
with pytest.raises(vban_cmd.error.VBANCMDError) as exc_info: )
with pytest.raises(vban_cmd.error.VBANCMDError, match=re.escape(EXPECTED_MSG)):
vban.apply_config("unknown") vban.apply_config("unknown")
e = exc_info.value
assert e.message == "\n".join(EXPECTED_MSG)
def test_it_tests_an_invalid_config_key(self): def test_it_tests_an_invalid_config_key(self):
CONFIG = { CONFIG = {
"strip-0": {"A1": True, "B1": True, "gain": -6.0}, "strip-0": {"A1": True, "B1": True, "gain": -6.0},