Example #1
0
    def test_load_read_csv(self):

        # nosetests -s -v dlstats.tests.fetchers.test_bis:BISUtilsTestCase.test_load_read_csv
        
        d = FETCHER_DATASETS.copy()
        print()
        for dataset_code, dataset in d.items():
            if dataset_code != "DSRP":
                continue
            filepath = FETCHER_DATASETS[dataset_code]["filepath"]
            datas = dataset['datas']            
            fileobj = io.StringIO(datas)#, newline=os.linesep)
            rows, headers, release_date, dimension_keys, periods = bis.local_read_csv(fileobj=fileobj)
            self.assertTrue('KEY' in headers)
            line1 = bis.csv_dict(headers, next(rows))
            #TODO: test values ?
            print(dataset_code, dimension_keys, line1)
            self.assertEqual(len(dimension_keys), FETCHER_DATASETS[dataset_code]["dimensions_count"])
Example #2
0
# -*- coding: utf-8 -*-

__all__ = ['FETCHERS', 'FETCHERS_DATASETS']

FETCHERS = {}
FETCHERS_DATASETS = {}

try:
    from dlstats.fetchers.bis import BIS, DATASETS as DATASETS_BIS
    FETCHERS['BIS'] = BIS
    FETCHERS_DATASETS['BIS'] = DATASETS_BIS.copy()
    __all__.append('BIS')
except ImportError:
    pass

try:
    from dlstats.fetchers.oecd import OECD, DATASETS as DATASETS_OECD
    FETCHERS['OECD'] = OECD
    FETCHERS_DATASETS['OECD'] = DATASETS_OECD.copy()
    __all__.append('OECD')
except ImportError:
    pass

try:
    from dlstats.fetchers.eurostat import Eurostat
    FETCHERS['Eurostat'] = Eurostat
    #TODO: FETCHERS_DATASETS['EUROSTAT'] = None
    __all__.append('Eurostat')
except ImportError:
    pass