# Path: srsly/tests/ruamel_yaml/roundtrip.py
# def YAML(**kw):
#     import srsly.ruamel_yaml  # NOQA
# 
#     class MyYAML(srsly.ruamel_yaml.YAML):
#         """auto dedent string parameters on load"""
# 
#         def load(self, stream):
#             if isinstance(stream, str):
#                 if stream and stream[0] == "\n":
#                     stream = stream[1:]
#                 stream = textwrap.dedent(stream)
#             return srsly.ruamel_yaml.YAML.load(self, stream)
# 
#         def load_all(self, stream):
#             if isinstance(stream, str):
#                 if stream and stream[0] == "\n":
#                     stream = stream[1:]
#                 stream = textwrap.dedent(stream)
#             for d in srsly.ruamel_yaml.YAML.load_all(self, stream):
#                 yield d
# 
#         def dump(self, data, **kw):
#             from srsly.ruamel_yaml.compat import StringIO, BytesIO  # NOQA
# 
#             assert ("stream" in kw) ^ ("compare" in kw)
#             if "stream" in kw:
#                 return srsly.ruamel_yaml.YAML.dump(data, **kw)
#             lkw = kw.copy()
#             expected = textwrap.dedent(lkw.pop("compare"))
#             unordered_lines = lkw.pop("unordered_lines", False)
#             if expected and expected[0] == "\n":
#                 expected = expected[1:]
#             lkw["stream"] = st = StringIO()
#             srsly.ruamel_yaml.YAML.dump(self, data, **lkw)
#             res = st.getvalue()
#             print(res)
#             if unordered_lines:
#                 res = sorted(res.splitlines())
#                 expected = sorted(expected.splitlines())
#             assert res == expected
# 
#         def round_trip(self, stream, **kw):
#             from srsly.ruamel_yaml.compat import StringIO, BytesIO  # NOQA
# 
#             assert isinstance(stream, (srsly.ruamel_yaml.compat.text_type, str))
#             lkw = kw.copy()
#             if stream and stream[0] == "\n":
#                 stream = stream[1:]
#             stream = textwrap.dedent(stream)
#             data = srsly.ruamel_yaml.YAML.load(self, stream)
#             outp = lkw.pop("outp", stream)
#             lkw["stream"] = st = StringIO()
#             srsly.ruamel_yaml.YAML.dump(self, data, **lkw)
#             res = st.getvalue()
#             if res != outp:
#                 diff(outp, res, "input string")
#             assert res == outp
# 
#         def round_trip_all(self, stream, **kw):
#             from srsly.ruamel_yaml.compat import StringIO, BytesIO  # NOQA
# 
#             assert isinstance(stream, (srsly.ruamel_yaml.compat.text_type, str))
#             lkw = kw.copy()
#             if stream and stream[0] == "\n":
#                 stream = stream[1:]
#             stream = textwrap.dedent(stream)
#             data = list(srsly.ruamel_yaml.YAML.load_all(self, stream))
#             outp = lkw.pop("outp", stream)
#             lkw["stream"] = st = StringIO()
#             srsly.ruamel_yaml.YAML.dump_all(self, data, **lkw)
#             res = st.getvalue()
#             if res != outp:
#                 diff(outp, res, "input string")
#             assert res == outp
# 
#     return MyYAML(**kw)


import pytest  # NOQA
from .roundtrip import YAML  # does an automatic dedent on load
        from textwrap import dedent
        from srsly.ruamel_yaml import safe_load
# coding: utf-8
from __future__ import print_function




"""
YAML 1.0 allowed root level literal style without indentation:
  "Usually top level nodes are not indented" (example 4.21 in 4.6.3)
YAML 1.1 is a bit vague but says:
  "Regardless of style, scalar content must always be indented by at least one space"
  (4.4.3)
  "In general, the document’s node is indented as if it has a parent indented at -1 spaces."
  (4.3.3)
YAML 1.2 is again clear about root literal level scalar after directive in example 9.5:

%YAML 1.2
--- |
%!PS-Adobe-2.0
...
%YAML1.2
---
# Empty
...
"""


class TestNoIndent:
    def test_root_literal_scalar_indent_example_9_5(self):

# Path: srsly/tests/ruamel_yaml/roundtrip.py
# def YAML(**kw):
#     import srsly.ruamel_yaml  # NOQA
# 
#     class MyYAML(srsly.ruamel_yaml.YAML):
#         """auto dedent string parameters on load"""
# 
#         def load(self, stream):
#             if isinstance(stream, str):
#                 if stream and stream[0] == "\n":
#                     stream = stream[1:]
#                 stream = textwrap.dedent(stream)
#             return srsly.ruamel_yaml.YAML.load(self, stream)
# 
#         def load_all(self, stream):
#             if isinstance(stream, str):
#                 if stream and stream[0] == "\n":
#                     stream = stream[1:]
#                 stream = textwrap.dedent(stream)
#             for d in srsly.ruamel_yaml.YAML.load_all(self, stream):
#                 yield d
# 
#         def dump(self, data, **kw):
#             from srsly.ruamel_yaml.compat import StringIO, BytesIO  # NOQA
# 
#             assert ("stream" in kw) ^ ("compare" in kw)
#             if "stream" in kw:
#                 return srsly.ruamel_yaml.YAML.dump(data, **kw)
#             lkw = kw.copy()
#             expected = textwrap.dedent(lkw.pop("compare"))
#             unordered_lines = lkw.pop("unordered_lines", False)
#             if expected and expected[0] == "\n":
#                 expected = expected[1:]
#             lkw["stream"] = st = StringIO()
#             srsly.ruamel_yaml.YAML.dump(self, data, **lkw)
#             res = st.getvalue()
#             print(res)
#             if unordered_lines:
#                 res = sorted(res.splitlines())
#                 expected = sorted(expected.splitlines())
#             assert res == expected
# 
#         def round_trip(self, stream, **kw):
#             from srsly.ruamel_yaml.compat import StringIO, BytesIO  # NOQA
# 
#             assert isinstance(stream, (srsly.ruamel_yaml.compat.text_type, str))
#             lkw = kw.copy()
#             if stream and stream[0] == "\n":
#                 stream = stream[1:]
#             stream = textwrap.dedent(stream)
#             data = srsly.ruamel_yaml.YAML.load(self, stream)
#             outp = lkw.pop("outp", stream)
#             lkw["stream"] = st = StringIO()
#             srsly.ruamel_yaml.YAML.dump(self, data, **lkw)
#             res = st.getvalue()
#             if res != outp:
#                 diff(outp, res, "input string")
#             assert res == outp
# 
#         def round_trip_all(self, stream, **kw):
#             from srsly.ruamel_yaml.compat import StringIO, BytesIO  # NOQA
# 
#             assert isinstance(stream, (srsly.ruamel_yaml.compat.text_type, str))
#             lkw = kw.copy()
#             if stream and stream[0] == "\n":
#                 stream = stream[1:]
#             stream = textwrap.dedent(stream)
#             data = list(srsly.ruamel_yaml.YAML.load_all(self, stream))
#             outp = lkw.pop("outp", stream)
#             lkw["stream"] = st = StringIO()
#             srsly.ruamel_yaml.YAML.dump_all(self, data, **lkw)
#             res = st.getvalue()
#             if res != outp:
#                 diff(outp, res, "input string")
#             assert res == outp
# 
#     return MyYAML(**kw)


# Path: srsly/tests/ruamel_yaml/test_literal.py
import pytest  # NOQA
from .roundtrip import YAML  # does an automatic dedent on load
        from textwrap import dedent
        from srsly.ruamel_yaml import safe_load

# coding: utf-8
from __future__ import print_function




"""
YAML 1.0 allowed root level literal style without indentation:
  "Usually top level nodes are not indented" (example 4.21 in 4.6.3)
YAML 1.1 is a bit vague but says:
  "Regardless of style, scalar content must always be indented by at least one space"
  (4.4.3)
  "In general, the document’s node is indented as if it has a parent indented at -1 spaces."
  (4.3.3)
YAML 1.2 is again clear about root literal level scalar after directive in example 9.5:

%YAML 1.2
--- |
%!PS-Adobe-2.0
...
%YAML1.2
---
# Empty
...
"""


class TestNoIndent:
    def test_root_literal_scalar_indent_example_9_5(self):

        yaml = YAML()