def test_get_dilutedeps_with_api_exception(self):
        with patch.object(intrinio_data.company_api, 'get_company_historical_data', \
                    side_effect=ApiException("Server Error")), \
             patch('support.financial_cache.cache', new=nop.Nop()):

            with self.assertRaises(DataError):
                intrinio_data.get_diluted_eps('NON-EXISTENT-TICKER', 2018)
コード例 #2
0
 def test_historical_cashflow_stmt_with_api_exception(self):
     with patch.object(intrinio_data.FUNDAMENTALS_API, 'get_fundamental_standardized_financials',
                       side_effect=ApiException("Not Found")), \
             patch('support.financial_cache.cache', new=nop.Nop()):
         with self.assertRaises(DataError):
             intrinio_data.get_historical_cashflow_stmt(
                 'NON-EXISTENT-TICKER', 2018, 2018, None)
コード例 #3
0
    def test_read_company_data_point_with_api_exception(self):
        with patch.object(intrinio_data.COMPANY_API, 'get_company_data_point_number',
                          side_effect=ApiException("Server Error")), \
                patch('support.financial_cache.cache', new=nop.Nop()):

            with self.assertRaises(DataError):
                intrinio_data._read_company_data_point('NON-EXISTENT-TICKER',
                                                       'tag')
コード例 #4
0
 def test_latest_stock_prices_with_exception(self):
     with patch.object(intrinio_data.SECURITY_API, 'get_security_stock_prices',
                       side_effect=ApiException("Not Found")), \
             patch('support.financial_cache.cache', new=nop.Nop()):
         with self.assertRaises(DataError):
             intrinio_data.get_latest_close_price('XXX',
                                                  datetime.date(2018, 1, 1),
                                                  5)
コード例 #5
0
 def test_daily_stock_prices_with_other_exception(self):
     with patch.object(intrinio_data.SECURITY_API, 'get_security_stock_prices',
                       side_effect=KeyError("xxx")), \
             patch('support.financial_cache.cache', new=nop.Nop()):
         with self.assertRaises(ValidationError):
             intrinio_data.get_daily_stock_close_prices(
                 'NON-EXISTENT-TICKER', datetime.date(2018, 1, 1),
                 datetime.date(2019, 1, 1))
コード例 #6
0
    def test_read_financial_metric_with_api_exception(self):
        with patch.object(intrinio_data.COMPANY_API, 'get_company_historical_data',
                          side_effect=ApiException("Server Error")), \
                patch('support.financial_cache.cache', new=nop.Nop()):

            (start_date) = intrinio_util.get_year_date_range(2018, 0)[0]

            with self.assertRaises(DataError):
                intrinio_data._get_company_historical_data(
                    'NON-EXISTENT-TICKER', start_date, start_date, 'tag')
 def test_daily_stock_prices_with_api_exception(self):
     with patch.object(intrinio_data.security_api, 'get_security_stock_prices',
                     side_effect=ApiException("Not Found")), \
          patch('support.financial_cache.cache', new=nop.Nop()):
         with self.assertRaises(DataError):
             intrinio_data.get_daily_stock_close_prices('NON-EXISTENT-TICKER', datetime.date(2018, 1, 1), datetime.date(2019, 1, 1))