From 363c491ea29a39e8ecb5d892c8499a44d3c4fcfe Mon Sep 17 00:00:00 2001 From: LuisFros Date: Fri, 7 May 2021 15:54:24 +0200 Subject: [PATCH] fix(): add compatibility with PY 3.5 --- snapshottest/ignore.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snapshottest/ignore.py b/snapshottest/ignore.py index 2de6cdf..6731dcf 100644 --- a/snapshottest/ignore.py +++ b/snapshottest/ignore.py @@ -5,9 +5,9 @@ def update_path(current_path, key_or_index, is_dict=False): if is_dict: if current_path == "": return key_or_index - return f"{current_path}.{key_or_index}" + return "{}.{}".format(current_path,key_or_index) else: - return f"{current_path}[{key_or_index}]" + return "{}[{}]".format(current_path,key_or_index) def clear_ignore_keys(data, ignore_keys, current_path=""): @@ -36,7 +36,7 @@ def clear_ignore_keys(data, ignore_keys, current_path=""): def match_ignored_key(key_or_index, data, ignore_keys, temp_path): for ignored in ignore_keys: escaped = ignored.translate(str.maketrans({"[": r"\[", "]": r"\]"})) - if re.match(f"{escaped}$", temp_path): + if re.match("{}$".format(escaped), temp_path): data[key_or_index] = None return True return False