diff options
author | sixolet <naomi@seyfer.org> | 2018-09-11 11:02:44 -0700 |
---|---|---|
committer | sixolet <naomi@seyfer.org> | 2018-09-11 11:02:44 -0700 |
commit | c242392fb97608e4f0859163cecec34773146542 (patch) | |
tree | a7af79d626b2a9da782b2082b2da9ae51e7307fc /_test | |
parent | f2e5ad1e946a5401753a4058269f933c6d94fc62 (diff) | |
download | ruamel.yaml-c242392fb97608e4f0859163cecec34773146542.tar.gz |
Stop explicitly-indented literals from stacking with flow-based indents.
Previously, when the emitter was writing a literal with an explicit indent, it
would also apply the current block indent, which is incorrect. Now it only
applies the explicit indent.
This bug was introduced in https://bitbucket.org/ruamel/yaml/commits/b57e2dd549e2b561cb0b418a180365c1fde2722a
Diffstat (limited to '_test')
-rw-r--r-- | _test/test_issues.py | 6 | ||||
-rw-r--r-- | _test/test_literal.py | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/_test/test_issues.py b/_test/test_issues.py index d37b297..8905655 100644 --- a/_test/test_issues.py +++ b/_test/test_issues.py @@ -108,7 +108,7 @@ class TestIssues: yaml = YAML() data = yaml.load(inp) child = data['child'] - assert 'second' in {**child} + assert 'second' in dict(**child) def test_issue_160(self): s = dedent("""\ @@ -411,7 +411,7 @@ class TestIssues: def test_issue_233(self): from ruamel.yaml import YAML import json - + yaml = YAML() data = yaml.load("{}") json_str = json.dumps(data) @@ -420,7 +420,7 @@ class TestIssues: def test_issue_233a(self): from ruamel.yaml import YAML import json - + yaml = YAML() data = yaml.load("[]") json_str = json.dumps(data) diff --git a/_test/test_literal.py b/_test/test_literal.py index 698ece5..a9b34e1 100644 --- a/_test/test_literal.py +++ b/_test/test_literal.py @@ -217,6 +217,18 @@ class TestNoIndent: print(type(d), repr(d)) yaml.round_trip(inp) + def test_nested_literal_doc_indent_marker(self): + yaml = YAML() + yaml.explicit_start = True + inp = """ + --- + a: |2 + some more + text + """ + d = yaml.load(inp) + print(type(d), repr(d)) + yaml.round_trip(inp) class Test_RoundTripLiteral: def test_rt_root_literal_scalar_no_indent(self): |