Disable 'default_flow_style' for yaml.dump

If this option is False,
the collections is always serialized in the block style.

Change-Id: I8e8d7cc1773b8c20968ff526110387a0590690b1
Closes-Bug: 1585271
This commit is contained in:
Bulat Gaifullin 2016-05-24 18:48:25 +03:00
parent 0af74e41be
commit bdf612bf43
2 changed files with 6 additions and 2 deletions

View File

@ -138,7 +138,9 @@ class TestYaqlExt(BaseUnitTest):
)
def test_to_yaml(self):
expected = yaml.safe_dump(self.variables['$%new']['configs'])
expected = yaml.safe_dump(
self.variables['$%new']['configs'], default_flow_style=False
)
actual = self.evaluate('$.configs.toYaml()')
self.assertEqual(expected, actual)

View File

@ -28,7 +28,9 @@ else:
@specs.method
@specs.inject('finalizer', yaqltypes.Delegate('#finalize'))
def to_yaml(finalizer, receiver):
return yaml.dump_all([finalizer(receiver)], Dumper=YamlDumper)
return yaml.dump_all(
[finalizer(receiver)], Dumper=YamlDumper, default_flow_style=False
)
@specs.method