Ejemplo n.º 1
0
    def docs(self, path):
        from srsly.ruamel_yaml import YAML

        tyaml = YAML(typ="safe", pure=True)
        tyaml.register_class(YAMLData)
        tyaml.register_class(Python)
        tyaml.register_class(Output)
        tyaml.register_class(Assert)
        return list(tyaml.load_all(path))
Ejemplo n.º 2
0
    def test_multi_document_load(self, tmpdir):
        """this went wrong on 3.7 because of StopIteration, PR 37 and Issue 211"""
        from srsly.ruamel_yaml import YAML

        fn = Path(str(tmpdir)) / "test.yaml"
        fn.write_text(
            textwrap.dedent(u"""\
            ---
            - a
            ---
            - b
            ...
            """))
        yaml = YAML()
        assert list(yaml.load_all(fn)) == [["a"], ["b"]]