Exemplo n.º 1
0
 def test_fetch_price__naive_time_no_timeozne(self, fetch_cached):
     fetch_cached.return_value = SourcePrice(
         Decimal('125.00'), datetime.datetime(2015, 11, 22, 16, 0, 0), 'JPY')
     dprice = price.DatedPrice('JPY', 'USD', datetime.date(2015, 11, 22), None)
     with self.assertRaises(ValueError):
         price.fetch_price(dprice._replace(sources=[
             price.PriceSource(yahoo, 'USDJPY', False)]), False)
Exemplo n.º 2
0
 def test_expressions(self):
     with test_utils.capture('stderr'):
         args, jobs, _, __ = run_with_args(
             price.process_args, ['--no-cache', '-e', 'USD:yahoo/AAPL'])
         self.assertEqual(
             [price.DatedPrice(
                 'AAPL', 'USD', None,
                 [price.PriceSource(yahoo, 'AAPL', False)])], jobs)
Exemplo n.º 3
0
 def setUp(self):
     fetch_cached = mock.patch('beanprice.price.fetch_cached_price').start()
     fetch_cached.return_value = SourcePrice(
         Decimal('125.00'), datetime.datetime(2015, 11, 22, 16, 0, 0,
                                              tzinfo=tz.tzlocal()),
         'JPY')
     self.dprice = price.DatedPrice('JPY', 'USD', datetime.date(2015, 11, 22),
                                    None)
     self.addCleanup(mock.patch.stopall)