Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_dumps_trailing_space_in_value():
assert dumps({"key": "value "}, timestamp=False) == 'key=value \n'
def test_dumps_vertical_tab():
assert dumps({"vertical-tab": "\v"}, timestamp=False) == \
'vertical-tab=\\u000b\n'
def test_dumps_delete():
assert dumps({"delete": "\x7F"}, timestamp=False) == 'delete=\\u007f\n'
def test_dumps_two_simple():
assert dumps([("key", "value"), ("zebra", "apple")], timestamp=False) == \
'key=value\nzebra=apple\n'
def test_dumps_exclamation():
assert dumps({"exclamation": "!"}, timestamp=False) == 'exclamation=\\!\n'
def test_dumps_multiline_comment():
assert dumps({"key": "value"}, comments='This is a comment.\nThis is also a comment.', timestamp=False) == '#This is a comment.\n#This is also a comment.\nkey=value\n'
def test_dumps_backslash():
assert dumps({"backslash": "\\"}, timestamp=False) == 'backslash=\\\\\n'
def test_dumps_hash_comment():
assert dumps({"key": "value"}, comments='#This is a double comment.', timestamp=False) == '##This is a double comment.\nkey=value\n'
def test_dumps_bell():
assert dumps({"bell": "\a"}, timestamp=False) == 'bell=\\u0007\n'
def test_dumps_timestamp_and_comment():
assert dumps(
{"key": "value"},
comments='This is a comment.',
timestamp=1473703254
) == '#This is a comment.\n#Mon Sep 12 14:00:54 EDT 2016\nkey=value\n'