Stylistic pre-commit junk
parent
99bf4215a3
commit
00b78e7a47
|
@ -537,8 +537,10 @@ _JSON_ESCAPE_MAP = {
|
||||||
"f": "\f",
|
"f": "\f",
|
||||||
"n": "\n",
|
"n": "\n",
|
||||||
"r": "\r",
|
"r": "\r",
|
||||||
"t": "\t"
|
"t": "\t",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _un_json_escape(json_string):
|
def _un_json_escape(json_string):
|
||||||
"""
|
"""
|
||||||
Removes JSON string literal escapes. We should undo these things Python's
|
Removes JSON string literal escapes. We should undo these things Python's
|
||||||
|
|
|
@ -189,14 +189,16 @@ def test_empty_hash():
|
||||||
SomeSCO(hashes={})
|
SomeSCO(hashes={})
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("json_escaped, expected_unescaped", [
|
@pytest.mark.parametrize(
|
||||||
|
"json_escaped, expected_unescaped", [
|
||||||
("", ""),
|
("", ""),
|
||||||
("a", "a"),
|
("a", "a"),
|
||||||
(r"\n", "\n"),
|
(r"\n", "\n"),
|
||||||
(r"\n\r\b\t\\\/\"", "\n\r\b\t\\/\""),
|
(r"\n\r\b\t\\\/\"", "\n\r\b\t\\/\""),
|
||||||
(r"\\n", r"\n"),
|
(r"\\n", r"\n"),
|
||||||
(r"\\\n", "\\\n")
|
(r"\\\n", "\\\n"),
|
||||||
])
|
],
|
||||||
|
)
|
||||||
def test_json_unescaping(json_escaped, expected_unescaped):
|
def test_json_unescaping(json_escaped, expected_unescaped):
|
||||||
actual_unescaped = stix2.base._un_json_escape(json_escaped)
|
actual_unescaped = stix2.base._un_json_escape(json_escaped)
|
||||||
assert actual_unescaped == expected_unescaped
|
assert actual_unescaped == expected_unescaped
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
import re
|
import re
|
||||||
import uuid
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import pytz
|
import pytz
|
||||||
|
|
Loading…
Reference in New Issue