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", "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

View File

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

View File

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