# Path: tests/context.py

# 
# Path: tests/support/decorators.py
# def load_expected_result():
#     def case_decorator(test):
#         case_filename = test.__name__.split("test_")[-1]
# 
#         @wraps(test)
#         def decorated_test(*args, **kwargs):
#             result_path = os.path.join(RESULTS_DIR, case_filename + ".json")
# 
#             with io.open(result_path, encoding='utf8') as result_file:
#                 expected_result = json.load(result_file)
# 
#             kwargs["expected_result"] = expected_result
#             test(*args, **kwargs)
# 
#         return decorated_test
# 
#     return case_decorator
# 
# RESULTS_DIR = os.path.join("tests", "results")


import os.path
import nose
import requests_mock
import vcr
    import mock
from collections import OrderedDict
from pprint import pprint
from nose.tools import assert_false, assert_equal
from nose.tools import assert_list_equal, assert_raises
from six import iteritems
    from unittest import mock
from .context import pydatajson
from .support.decorators import load_expected_result, RESULTS_DIR
                         ('cant_errores', 4),
                         ('cant_distribuciones', 4)]),
            OrderedDict([('indice', 1),
                         ('titulo',
                          'Sistema de contrataciones electrónicas DOS'),
                         ('identificador', '2'),
                         ('estado_metadatos', 'OK'),
                         ('cant_errores', 0),
                         ('cant_distribuciones', 1)]),
            OrderedDict([('indice', 2),
                         ('titulo',
                          'Sistema de contrataciones electrónicas TRES'),
                         ('identificador', '3'),
                         ('estado_metadatos', 'OK'),
                         ('cant_errores', 0),
                         ('cant_distribuciones', 1)])]

        assert_list_equal(actual, expected)

    def test_DataJson_constructor(self):
        for key, value in iteritems(self.catalog):
            if key != "dataset":
                assert_equal(self.dj[key], value)

    def test_datasets_property(self):
        """La propiedad datasets equivale a clave 'dataset' de un catalog."""
        assert_equal(self.dj.datasets,
                     pydatajson.DataJson(self.catalog)["dataset"])
        assert_equal(self.dj.datasets, self.dj["dataset"])


# Path: tests/context.py

# 
# Path: tests/support/decorators.py
# def load_expected_result():
#     def case_decorator(test):
#         case_filename = test.__name__.split("test_")[-1]
# 
#         @wraps(test)
#         def decorated_test(*args, **kwargs):
#             result_path = os.path.join(RESULTS_DIR, case_filename + ".json")
# 
#             with io.open(result_path, encoding='utf8') as result_file:
#                 expected_result = json.load(result_file)
# 
#             kwargs["expected_result"] = expected_result
#             test(*args, **kwargs)
# 
#         return decorated_test
# 
#     return case_decorator
# 
# RESULTS_DIR = os.path.join("tests", "results")


# Path: tests/test_core.py
import os.path
import nose
import requests_mock
import vcr
    import mock
from collections import OrderedDict
from pprint import pprint
from nose.tools import assert_false, assert_equal
from nose.tools import assert_list_equal, assert_raises
from six import iteritems
    from unittest import mock
from .context import pydatajson
from .support.decorators import load_expected_result, RESULTS_DIR

                         ('cant_errores', 4),
                         ('cant_distribuciones', 4)]),
            OrderedDict([('indice', 1),
                         ('titulo',
                          'Sistema de contrataciones electrónicas DOS'),
                         ('identificador', '2'),
                         ('estado_metadatos', 'OK'),
                         ('cant_errores', 0),
                         ('cant_distribuciones', 1)]),
            OrderedDict([('indice', 2),
                         ('titulo',
                          'Sistema de contrataciones electrónicas TRES'),
                         ('identificador', '3'),
                         ('estado_metadatos', 'OK'),
                         ('cant_errores', 0),
                         ('cant_distribuciones', 1)])]

        assert_list_equal(actual, expected)

    def test_DataJson_constructor(self):
        for key, value in iteritems(self.catalog):
            if key != "dataset":
                assert_equal(self.dj[key], value)

    def test_datasets_property(self):
        """La propiedad datasets equivale a clave 'dataset' de un catalog."""
        assert_equal(self.dj.datasets,
                     pydatajson.DataJson(self.catalog)["dataset"])
        assert_equal(self.dj.datasets, self.dj["dataset"])


    @load_expected_result()