Stylistic pre-commit junk

pull/1/head
Michael Chisholm 2020-06-08 17:51:13 -04:00
parent 99bf4215a3
commit 00b78e7a47
3 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,5 @@
import datetime as dt
import re
import uuid
import pytest
import pytz