test/cql-pytest: use raw string when appropriate

we use "\w" to represent a character class in Python. see
https://docs.python.org/3/library/re.html. but "\" should be
escaped as well, CPython accepts "\w" after trying to find
an escaped character of "\."  but failed, and leave "\." as it is.
but it complains.

in this change, we use raw string to avoid escaping "\" in
the regular expression.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#16405
This commit is contained in:
Kefu Chai
2023-12-13 22:30:53 +08:00
committed by Avi Kivity
parent 514ef48d75
commit caa0230e5d

View File

@@ -122,7 +122,7 @@ def disablebinary(cql):
run_nodetool(cql, "disablebinary")
def parse_keyspace_table(name, separator_chars = '.'):
pat = f"(?P<keyspace>\w+)(?:[{separator_chars}](?P<table>\w+))?"
pat = rf"(?P<keyspace>\w+)(?:[{separator_chars}](?P<table>\w+))?"
m = re.match(pat, name)
return m.group('keyspace'), m.group('table')