def test_flow_style(self, capsys): # https://stackoverflow.com/questions/45791712/ from ruyaml import YAML yaml = YAML() yaml.default_flow_style = None data = yaml.map() data['b'] = 1 data['a'] = [[1, 2], [3, 4]] yaml.dump(data, sys.stdout) out, err = capsys.readouterr() assert out == 'b: 1\na:\n- [1, 2]\n- [3, 4]\n'
def save(self) -> None: """Save the configuration in the configuration YAML file.""" with open(os.path.expanduser(self.config_path), "w+") as file_cursor: yaml = YAML() yaml.default_flow_style = False yaml.dump(self.data, file_cursor)