diff options
| author | Anthon van der Neut <anthon@mnt.org> | 2021-03-09 09:02:50 +0100 |
|---|---|---|
| committer | Anthon van der Neut <anthon@mnt.org> | 2021-03-09 09:02:50 +0100 |
| commit | e73562c6f14d1d71a9fea174d58465e1b13f68af (patch) | |
| tree | 309851cca7d411b31c27753555871d493282c7f0 /_test/lib/test_recursive.py | |
| parent | 96839d9f64f4698bdc519cbfbd48d51178460714 (diff) | |
| download | ruamel.yaml-e73562c6f14d1d71a9fea174d58465e1b13f68af.tar.gz | |
remove python 2 specific code
add future deprecation warning to old style functions
Diffstat (limited to '_test/lib/test_recursive.py')
| -rw-r--r-- | _test/lib/test_recursive.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/_test/lib/test_recursive.py b/_test/lib/test_recursive.py index c87f879..88858e4 100644 --- a/_test/lib/test_recursive.py +++ b/_test/lib/test_recursive.py @@ -1,7 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function -import ruamel.yaml as yaml +import ruamel.yaml class AnInstance: @@ -25,6 +23,7 @@ class AnInstanceWithState(AnInstance): def test_recursive(recursive_filename, verbose=False): + yaml = ruamel.yaml.YAML(typ='safe', pure=True) context = globals().copy() with open(recursive_filename, 'rb') as fp0: exec(fp0.read(), context) @@ -33,9 +32,13 @@ def test_recursive(recursive_filename, verbose=False): value2 = None output2 = None try: - output1 = yaml.dump(value1) - value2 = yaml.load(output1) - output2 = yaml.dump(value2) + buf = ruamel.yaml.compat.StringIO() + output1 = yaml.dump(value1, buf) + yaml.load(output1) + value2 = buf.getvalue() + buf = ruamel.yaml.compat.StringIO() + yaml.dump(value2, buf) + output2 = buf.getvalue() assert output1 == output2, (output1, output2) finally: if verbose: |
