diff options
author | Anthon van der Neut <anthon@mnt.org> | 2017-04-04 10:05:01 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2017-04-04 10:05:01 +0200 |
commit | 334c46400c2334b3939c76ab7a7b5d9195b6d131 (patch) | |
tree | 1f92afaffb8689b508234157a179f40df3b84856 /_test/test_none.py | |
parent | 106d8df15be91d294b6a6efd4476fdc87c0a9b5d (diff) | |
download | ruamel.yaml-334c46400c2334b3939c76ab7a7b5d9195b6d131.tar.gz |
fix issue #109 and #110
issue 109: None not represented round-trippable at top level, reported by
Andrea Censi
issue 110: .replace() on a ScalarString subclass would return a string instead
of an instance of that subclass, reported by sandres23
Diffstat (limited to '_test/test_none.py')
-rw-r--r-- | _test/test_none.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/_test/test_none.py b/_test/test_none.py new file mode 100644 index 0000000..ad51109 --- /dev/null +++ b/_test/test_none.py @@ -0,0 +1,42 @@ +# coding: utf-8 + + +import pytest # NOQA +import ruamel.yaml # NOQA + + +class TestNone: + def test_dump00(self): + data = None + s = ruamel.yaml.round_trip_dump(data) + assert s == 'null\n...\n' + d = ruamel.yaml.round_trip_load(s) + assert d == data + + def test_dump01(self): + data = None + s = ruamel.yaml.round_trip_dump(data, explicit_end=True) + assert s == 'null\n...\n' + d = ruamel.yaml.round_trip_load(s) + assert d == data + + def test_dump02(self): + data = None + s = ruamel.yaml.round_trip_dump(data, explicit_end=False) + assert s == 'null\n...\n' + d = ruamel.yaml.round_trip_load(s) + assert d == data + + def test_dump03(self): + data = None + s = ruamel.yaml.round_trip_dump(data, explicit_start=True) + assert s == '---\n...\n' + d = ruamel.yaml.round_trip_load(s) + assert d == data + + def test_dump04(self): + data = None + s = ruamel.yaml.round_trip_dump(data, explicit_start=True, explicit_end=False) + assert s == '---\n...\n' + d = ruamel.yaml.round_trip_load(s) + assert d == data |