# Path: tests/context.py



from functools import wraps
from six import text_type
from tests.context import pydatajson
import unittest
import nose
import os
import io
import json

        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

    @classmethod
    def get_sample(cls, sample_filename):
        return os.path.join(SAMPLES_DIR, sample_filename)

    @classmethod
    def setUp(cls):
        cls.catalog = cls.get_sample("full_data.json")
        cls.catalog_ts = cls.get_sample("time_series_data.json")

    @load_expected_result()
    def test_datasets(self, expected_result):

# Path: tests/context.py



# Path: tests/test_search.py
from functools import wraps
from six import text_type
from tests.context import pydatajson
import unittest
import nose
import os
import io
import json


        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

    @classmethod
    def get_sample(cls, sample_filename):
        return os.path.join(SAMPLES_DIR, sample_filename)

    @classmethod
    def setUp(cls):
        cls.catalog = cls.get_sample("full_data.json")
        cls.catalog_ts = cls.get_sample("time_series_data.json")

    @load_expected_result()
    def test_datasets(self, expected_result):

        datasets = pydatajson.search.get_datasets(self.catalog)