예제 #1
0
    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'
예제 #2
0
파일: config.py 프로젝트: lyz-code/pydo
 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)