# Path: srsly/ruamel_yaml/compat.py
# PY3 = sys.version_info[0] == 3


import sys
import os
import types
import traceback
import pprint
import argparse
from srsly.ruamel_yaml.compat import PY3
from __future__ import print_function


# DATA = 'tests/data'
# determine the position of data dynamically relative to program
# this allows running test while the current path is not the top of the
# repository, e.g. from the tests/data directory: python ../test_yaml.py
DATA = __file__.rsplit(os.sep, 2)[0] + "/data"


def find_test_functions(collections):
    if not isinstance(collections, list):
        collections = [collections]
    functions = []
    for collection in collections:
        if not isinstance(collection, dict):
            collection = vars(collection)
        for key in sorted(collection):
            value = collection[key]
            if isinstance(value, types.FunctionType) and hasattr(value, "unittest"):
                functions.append(value)
    return functions


def find_test_filenames(directory):
    filenames = {}
    for filename in os.listdir(directory):
        if os.path.isfile(os.path.join(directory, filename)):
            base, ext = os.path.splitext(filename)

# Path: srsly/ruamel_yaml/compat.py
# PY3 = sys.version_info[0] == 3


# Path: srsly/tests/ruamel_yaml/test_appliance.py
import sys
import os
import types
import traceback
import pprint
import argparse
from srsly.ruamel_yaml.compat import PY3

from __future__ import print_function


# DATA = 'tests/data'
# determine the position of data dynamically relative to program
# this allows running test while the current path is not the top of the
# repository, e.g. from the tests/data directory: python ../test_yaml.py
DATA = __file__.rsplit(os.sep, 2)[0] + "/data"


def find_test_functions(collections):
    if not isinstance(collections, list):
        collections = [collections]
    functions = []
    for collection in collections:
        if not isinstance(collection, dict):
            collection = vars(collection)
        for key in sorted(collection):
            value = collection[key]
            if isinstance(value, types.FunctionType) and hasattr(value, "unittest"):
                functions.append(value)
    return functions


def find_test_filenames(directory):
    filenames = {}
    for filename in os.listdir(directory):
        if os.path.isfile(os.path.join(directory, filename)):
            base, ext = os.path.splitext(filename)

            if base.endswith("-py2" if PY3 else "-py3"):