# Path: binstar_client/inspect_package/r.py
# def parse_package_list(package_spec):
# def inspect_r_package(filename, fileobj, *args, **kwargs):
# 
# Path: binstar_client/utils/test/utils.py
# def data_dir(filename):
#     base_path = inspect.stack()[1][1]  # function caller path
#     test_data = os.path.join(os.path.dirname(base_path), 'data')
#     return os.path.join(test_data, filename)


import unittest
from binstar_client.inspect_package import r
from binstar_client.utils.test.utils import data_dir
}

expected_file_data = {
    'attrs': {
        'NeedsCompilation': 'no',
        'suggests': [
            'fortunes',
            'stringr',
            'sos',
            'XLConnect',
            'reshape2',
            'ggplot2',
            'foreign',
            'lattice',
        ],
        'depends': [],
        'type': 'source',
    },
    'basename': 'rfordummies_0.1.2.tar.gz',
}


class Test(unittest.TestCase):
    maxDiff = None
    def test_r(self):
        filename = data_dir('rfordummies_0.1.2.tar.gz')
        with open(filename, 'rb') as fd:
            package_data, version_data, file_data = r.inspect_r_package(filename, fd)

        self.assertEqual(expected_package_data, package_data)

# Path: binstar_client/inspect_package/r.py
# def parse_package_list(package_spec):
# def inspect_r_package(filename, fileobj, *args, **kwargs):
# 
# Path: binstar_client/utils/test/utils.py
# def data_dir(filename):
#     base_path = inspect.stack()[1][1]  # function caller path
#     test_data = os.path.join(os.path.dirname(base_path), 'data')
#     return os.path.join(test_data, filename)


# Path: binstar_client/inspect_package/tests/test_r.py
import unittest
from binstar_client.inspect_package import r
from binstar_client.utils.test.utils import data_dir

}

expected_file_data = {
    'attrs': {
        'NeedsCompilation': 'no',
        'suggests': [
            'fortunes',
            'stringr',
            'sos',
            'XLConnect',
            'reshape2',
            'ggplot2',
            'foreign',
            'lattice',
        ],
        'depends': [],
        'type': 'source',
    },
    'basename': 'rfordummies_0.1.2.tar.gz',
}


class Test(unittest.TestCase):
    maxDiff = None
    def test_r(self):
        filename = data_dir('rfordummies_0.1.2.tar.gz')
        with open(filename, 'rb') as fd:
            package_data, version_data, file_data = r.inspect_r_package(filename, fd)

        self.assertEqual(expected_package_data, package_data)

        self.assertEqual(expected_version_data, version_data)