diff options
author | Anthon van der Neut <anthon@mnt.org> | 2016-02-29 15:03:18 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2016-02-29 15:03:18 +0100 |
commit | d9cb9dea8e9dff1f0c91d1f2ad0ef1ad9c7ed569 (patch) | |
tree | 9854b0e33f72ef281665623ab49267d20821952a /_test | |
parent | e600daa78ebdd7e5b4dd39344822699f1f6721c8 (diff) | |
download | ruamel.yaml-d9cb9dea8e9dff1f0c91d1f2ad0ef1ad9c7ed569.tar.gz |
guessing routine, RTD support
- guessing routine now returns block_seq_indent guess as well
as indent guess
- split README.rst up into _doc/*.rst entries
Diffstat (limited to '_test')
-rw-r--r-- | _test/test_indentation.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/_test/test_indentation.py b/_test/test_indentation.py index 72ef8dc..8764109 100644 --- a/_test/test_indentation.py +++ b/_test/test_indentation.py @@ -10,6 +10,8 @@ from textwrap import dedent import pytest # NOQA import ruamel.yaml +from ruamel.yaml.util import load_yaml_guess_indent + from roundtrip import round_trip @@ -148,5 +150,35 @@ class TestIndent: 2 """, indent=2, block_seq_indent=2) +def guess(s): + x, y, z = load_yaml_guess_indent(dedent(s)) + return y, z + +class TestGuessIndent: + def test_guess_20(self): + assert guess("""\ + a: + - 1 + """) == (2, 0) + + def test_guess_42(self): + assert guess("""\ + a: + - 1 + """) == (4, 2) + + def test_guess_42(self): + assert guess("""\ + b: + a: + - 1 + """) == (4, 2) + + def test_guess_3None(self): + assert guess("""\ + b: + a: 1 + """) == (3, None) + # ############ indentation |