コード例 #1
0
 def test_get_prc_hicp_manr_exceeds_limit(self):
     # see gh-149
     msg = 'Query size exceeds maximum limit'
     with assert_raises_regex(ValueError, msg):
         web.DataReader('prc_hicp_manr', 'eurostat',
                        start=pd.Timestamp('2000-01-01'),
                        end=pd.Timestamp('2013-01-01'))
コード例 #2
0
ファイル: test_wb.py プロジェクト: anshikka/Soda
    def test_wdi_download_error_handling(self):
        cntry_codes = ['USA', 'XX']
        inds = 'NY.GDP.PCAP.CD'

        msg = "Invalid Country Code\\(s\\): XX"
        with assert_raises_regex(ValueError, msg):
            download(country=cntry_codes,
                     indicator=inds,
                     start=2003,
                     end=2004,
                     errors='raise')

        with tm.assert_produces_warning():
            result = download(country=cntry_codes,
                              indicator=inds,
                              start=2003,
                              end=2004,
                              errors='warn')
            assert isinstance(result, pd.DataFrame)
            assert len(result), 2

        cntry_codes = ['USA']
        inds = ['NY.GDP.PCAP.CD', 'BAD_INDICATOR']

        msg = ("The provided parameter value is not valid\\. "
               "Indicator: BAD_INDICATOR")
        with assert_raises_regex(ValueError, msg):
            download(country=cntry_codes,
                     indicator=inds,
                     start=2003,
                     end=2004,
                     errors='raise')

        with tm.assert_produces_warning():
            result = download(country=cntry_codes,
                              indicator=inds,
                              start=2003,
                              end=2004,
                              errors='warn')
            assert isinstance(result, pd.DataFrame)
            assert len(result) == 2