diff --git a/stix2/base.py b/stix2/base.py index 7336285..910042a 100644 --- a/stix2/base.py +++ b/stix2/base.py @@ -537,8 +537,10 @@ _JSON_ESCAPE_MAP = { "f": "\f", "n": "\n", "r": "\r", - "t": "\t" + "t": "\t", } + + def _un_json_escape(json_string): """ Removes JSON string literal escapes. We should undo these things Python's diff --git a/stix2/test/v21/test_deterministic_ids.py b/stix2/test/v21/test_deterministic_ids.py index da72142..1e6e2d4 100644 --- a/stix2/test/v21/test_deterministic_ids.py +++ b/stix2/test/v21/test_deterministic_ids.py @@ -189,14 +189,16 @@ def test_empty_hash(): SomeSCO(hashes={}) -@pytest.mark.parametrize("json_escaped, expected_unescaped", [ - ("", ""), - ("a", "a"), - (r"\n", "\n"), - (r"\n\r\b\t\\\/\"", "\n\r\b\t\\/\""), - (r"\\n", r"\n"), - (r"\\\n", "\\\n") -]) +@pytest.mark.parametrize( + "json_escaped, expected_unescaped", [ + ("", ""), + ("a", "a"), + (r"\n", "\n"), + (r"\n\r\b\t\\\/\"", "\n\r\b\t\\/\""), + (r"\\n", r"\n"), + (r"\\\n", "\\\n"), + ], +) def test_json_unescaping(json_escaped, expected_unescaped): actual_unescaped = stix2.base._un_json_escape(json_escaped) assert actual_unescaped == expected_unescaped diff --git a/stix2/test/v21/test_observed_data.py b/stix2/test/v21/test_observed_data.py index 8cf2389..e0fa456 100644 --- a/stix2/test/v21/test_observed_data.py +++ b/stix2/test/v21/test_observed_data.py @@ -1,6 +1,5 @@ import datetime as dt import re -import uuid import pytest import pytz