# Path: srsly/tests/ruamel_yaml/roundtrip.py
# def round_trip_load(inp, preserve_quotes=None, version=None):
#     import srsly.ruamel_yaml  # NOQA
# 
#     dinp = dedent(inp)
#     return srsly.ruamel_yaml.load(
#         dinp,
#         Loader=srsly.ruamel_yaml.RoundTripLoader,
#         preserve_quotes=preserve_quotes,
#         version=version,
#     )
# 
# def round_trip_dump(
#     data,
#     stream=None,
#     indent=None,
#     block_seq_indent=None,
#     top_level_colon_align=None,
#     prefix_colon=None,
#     explicit_start=None,
#     explicit_end=None,
#     version=None,
# ):
#     import srsly.ruamel_yaml  # NOQA
# 
#     return srsly.ruamel_yaml.round_trip_dump(
#         data,
#         stream=stream,
#         indent=indent,
#         block_seq_indent=block_seq_indent,
#         top_level_colon_align=top_level_colon_align,
#         prefix_colon=prefix_colon,
#         explicit_start=explicit_start,
#         explicit_end=explicit_end,
#         version=version,
#     )
# 
# def dedent(data):
#     try:
#         position_of_first_newline = data.index("\n")
#         for idx in range(position_of_first_newline):
#             if not data[idx].isspace():
#                 raise ValueError
#     except ValueError:
#         pass
#     else:
#         data = data[position_of_first_newline + 1 :]
#     return textwrap.dedent(data)


import sys
import pytest  # NOQA
from .roundtrip import round_trip_load, round_trip_dump, dedent


class TestLeftOverDebug:
    # idea here is to capture round_trip_output via pytest stdout capture
    # if there is are any leftover debug statements they should show up
    def test_00(self, capsys):
        s = dedent(
            """
        a: 1
        b: []
        c: [a, 1]
        d: {f: 3.14, g: 42}
        """
        )
        d = round_trip_load(s)
        round_trip_dump(d, sys.stdout)
        out, err = capsys.readouterr()
        assert out == s

    def test_01(self, capsys):
        s = dedent(
            """
        - 1
        - []
        - [a, 1]
        - {f: 3.14, g: 42}
        - - 123
        """
        )
        d = round_trip_load(s)

# Path: srsly/tests/ruamel_yaml/roundtrip.py
# def round_trip_load(inp, preserve_quotes=None, version=None):
#     import srsly.ruamel_yaml  # NOQA
# 
#     dinp = dedent(inp)
#     return srsly.ruamel_yaml.load(
#         dinp,
#         Loader=srsly.ruamel_yaml.RoundTripLoader,
#         preserve_quotes=preserve_quotes,
#         version=version,
#     )
# 
# def round_trip_dump(
#     data,
#     stream=None,
#     indent=None,
#     block_seq_indent=None,
#     top_level_colon_align=None,
#     prefix_colon=None,
#     explicit_start=None,
#     explicit_end=None,
#     version=None,
# ):
#     import srsly.ruamel_yaml  # NOQA
# 
#     return srsly.ruamel_yaml.round_trip_dump(
#         data,
#         stream=stream,
#         indent=indent,
#         block_seq_indent=block_seq_indent,
#         top_level_colon_align=top_level_colon_align,
#         prefix_colon=prefix_colon,
#         explicit_start=explicit_start,
#         explicit_end=explicit_end,
#         version=version,
#     )
# 
# def dedent(data):
#     try:
#         position_of_first_newline = data.index("\n")
#         for idx in range(position_of_first_newline):
#             if not data[idx].isspace():
#                 raise ValueError
#     except ValueError:
#         pass
#     else:
#         data = data[position_of_first_newline + 1 :]
#     return textwrap.dedent(data)


# Path: srsly/tests/ruamel_yaml/test_z_check_debug_leftovers.py
import sys
import pytest  # NOQA
from .roundtrip import round_trip_load, round_trip_dump, dedent



class TestLeftOverDebug:
    # idea here is to capture round_trip_output via pytest stdout capture
    # if there is are any leftover debug statements they should show up
    def test_00(self, capsys):
        s = dedent(
            """
        a: 1
        b: []
        c: [a, 1]
        d: {f: 3.14, g: 42}
        """
        )
        d = round_trip_load(s)
        round_trip_dump(d, sys.stdout)
        out, err = capsys.readouterr()
        assert out == s

    def test_01(self, capsys):
        s = dedent(
            """
        - 1
        - []
        - [a, 1]
        - {f: 3.14, g: 42}
        - - 123
        """
        )
        d = round_trip_load(s)

        round_trip_dump(d, sys.stdout)