add more edge case handling for yaml unsafe marking

This commit is contained in:
Ryan Petrello
2018-04-19 09:13:56 -04:00
parent 31ea55acb9
commit f8211b0588
2 changed files with 13 additions and 1 deletions

View File

@@ -20,6 +20,18 @@ def test_raw_string():
assert safe_dump('foo') == "!unsafe 'foo'\n"
def test_kv_null():
assert safe_dump({'a': None}) == "!unsafe 'a': null\n"
def test_kv_null_safe():
assert safe_dump({'a': None}, {'a': None}) == "a: null\n"
def test_kv_null_unsafe():
assert safe_dump({'a': ''}, {'a': None}) == "!unsafe 'a': !unsafe ''\n"
def test_kv_int():
assert safe_dump({'a': 1}) == "!unsafe 'a': 1\n"