diff options
author | Anthon van der Neut <anthon@mnt.org> | 2016-07-06 23:31:57 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2016-07-06 23:31:57 +0200 |
commit | a990e4568c7f341cc76f5ab572a3089bb1065da4 (patch) | |
tree | 437e9b9e007dddc73510e805a554e139a84bef50 /_test/test_string.py | |
parent | bc5bd304c273b3c0067c2c8840efedd2bc4fc327 (diff) | |
download | ruamel.yaml-a990e4568c7f341cc76f5ab572a3089bb1065da4.tar.gz |
added optional preservation of quotes around scalars
Diffstat (limited to '_test/test_string.py')
-rw-r--r-- | _test/test_string.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/_test/test_string.py b/_test/test_string.py index 5aa0700..13474b5 100644 --- a/_test/test_string.py +++ b/_test/test_string.py @@ -22,13 +22,13 @@ import platform from roundtrip import round_trip, dedent, round_trip_load, round_trip_dump # NOQA -class TestYAML: +class TestPreservedScalarString: def test_basic_string(self): round_trip(""" a: abcdefg """, ) - def test_quoted_string(self): + def test_quoted_integer_string(self): round_trip(""" a: '12345' """) @@ -105,3 +105,22 @@ class TestYAML: def """, intermediate=dict(a='abc def\n\n')) + + +class TestQuotedScalarString: + def test_single_quoted_string(self): + round_trip(""" + a: 'abc' + """, preserve_quotes=True) + + def test_double_quoted_string(self): + round_trip(""" + a: "abc" + """, preserve_quotes=True) + + def test_non_preserved_double_quoted_string(self): + round_trip(""" + a: "abc" + """, outp=""" + a: abc + """) |