本文整理汇总了Python中pyiso.base.BaseClient类的典型用法代码示例。如果您正苦于以下问题:Python BaseClient类的具体用法?Python BaseClient怎么用?Python BaseClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseClient类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_handle_options_set
def test_handle_options_set(self):
"""Can set options"""
bc = BaseClient()
bc.handle_options(test='a', another=20)
self.assertEqual(bc.options['test'], 'a')
self.assertEqual(bc.options['another'], 20)
self.assertFalse(bc.options['sliceable'])
开发者ID:ecalifornica,项目名称:pyiso,代码行数:7,代码来源:test_base.py
示例2: test_handle_options_latest
def test_handle_options_latest(self):
"""Correct processing of time-related options for latest"""
bc = BaseClient()
bc.handle_options(latest=True)
self.assertTrue(bc.options['latest'])
self.assertFalse(bc.options['sliceable'])
self.assertFalse(bc.options['forecast'])
开发者ID:ecalifornica,项目名称:pyiso,代码行数:7,代码来源:test_base.py
示例3: test_handle_options_future
def test_handle_options_future(self):
"""Correct processing of time-related options for future start and end times"""
bc = BaseClient()
bc.handle_options(start_at='2100-01-01', end_at='2100-02-01')
self.assertTrue(bc.options['sliceable'])
self.assertEqual(bc.options['start_at'], datetime(2100, 1, 1, 0, tzinfo=pytz.utc))
self.assertEqual(bc.options['end_at'], datetime(2100, 2, 1, 0, tzinfo=pytz.utc))
self.assertTrue(bc.options['forecast'])
开发者ID:ecalifornica,项目名称:pyiso,代码行数:8,代码来源:test_base.py
示例4: test_handle_options_twice
def test_handle_options_twice(self):
"""Overwrite options on second call"""
bc = BaseClient()
bc.handle_options(forecast=True)
self.assertTrue(bc.options['forecast'])
bc.handle_options(yesterday=True)
self.assertFalse(bc.options['forecast'])
开发者ID:cnblevins,项目名称:pyiso,代码行数:8,代码来源:test_base.py
示例5: test_handle_options_past
def test_handle_options_past(self):
"""Correct processing of time-related options for historical start and end times"""
bc = BaseClient()
bc.handle_options(start_at="2014-01-01", end_at="2014-02-01")
self.assertTrue(bc.options["sliceable"])
self.assertEqual(bc.options["start_at"], datetime(2014, 1, 1, 0, tzinfo=pytz.utc))
self.assertEqual(bc.options["end_at"], datetime(2014, 2, 1, 0, tzinfo=pytz.utc))
self.assertFalse(bc.options["forecast"])
开发者ID:jkhooker,项目名称:pyiso,代码行数:8,代码来源:test_base.py
示例6: test_handle_options_forecast
def test_handle_options_forecast(self):
"""Correct auto-setup of time-related options for forecast"""
bc = BaseClient()
bc.handle_options(forecast=True)
self.assertTrue(bc.options['sliceable'])
local_now = pytz.utc.localize(datetime.utcnow()).astimezone(pytz.utc).replace(microsecond=0)
self.assertEqual(bc.options['start_at'], local_now)
self.assertEqual(bc.options['end_at'], local_now + timedelta(days=2))
self.assertTrue(bc.options['forecast'])
开发者ID:cnblevins,项目名称:pyiso,代码行数:9,代码来源:test_base.py
示例7: test_handle_options_forecast
def test_handle_options_forecast(self):
"""Correct auto-setup of time-related options for forecast"""
bc = BaseClient()
bc.handle_options(forecast=True)
self.assertTrue(bc.options['sliceable'])
local_now = pytz.utc.localize(datetime.utcnow()).astimezone(pytz.utc)
self.assertEqual(bc.options['start_at'], datetime(local_now.year, local_now.month, local_now.day, 0, tzinfo=pytz.utc))
self.assertEqual(bc.options['end_at'], datetime(local_now.year, local_now.month, local_now.day+2, 0, tzinfo=pytz.utc))
self.assertTrue(bc.options['forecast'])
开发者ID:egeriicw,项目名称:pyiso,代码行数:9,代码来源:test_base.py
示例8: test_handle_options_yesterday
def test_handle_options_yesterday(self):
"""Correct auto-setup of time-related options for yesterday"""
bc = BaseClient()
bc.handle_options(yesterday=True)
self.assertTrue(bc.options['sliceable'])
local_now = pytz.utc.localize(datetime.utcnow()).astimezone(pytz.utc)
midnight_today = datetime(local_now.year, local_now.month, local_now.day, 0, tzinfo=pytz.utc)
self.assertEqual(bc.options['start_at'], midnight_today - timedelta(days=1))
self.assertEqual(bc.options['end_at'], midnight_today)
self.assertFalse(bc.options['forecast'])
开发者ID:ecalifornica,项目名称:pyiso,代码行数:10,代码来源:test_base.py
示例9: test_handle_options_forecast
def test_handle_options_forecast(self):
"""Correct auto-setup of time-related options for forecast"""
bc = BaseClient()
bc.handle_options(forecast=True)
self.assertTrue(bc.options["sliceable"])
local_now = pytz.utc.localize(datetime.utcnow()).astimezone(pytz.utc)
midnight_today = datetime(local_now.year, local_now.month, local_now.day, 0, tzinfo=pytz.utc)
self.assertEqual(bc.options["start_at"], midnight_today)
self.assertEqual(bc.options["end_at"], midnight_today + timedelta(days=2))
self.assertTrue(bc.options["forecast"])
开发者ID:jkhooker,项目名称:pyiso,代码行数:10,代码来源:test_base.py
示例10: test_slice_empty
def test_slice_empty(self):
bc = BaseClient()
indf = pd.DataFrame()
outdf = bc.slice_times(indf, {'latest': True})
self.assertEqual(len(outdf), 0)
开发者ID:ecalifornica,项目名称:pyiso,代码行数:5,代码来源:test_base.py
示例11: test_bad_zipfile
def test_bad_zipfile(self):
bc = BaseClient()
badzip = 'I am not a zipfile'
result = bc.unzip(badzip)
self.assertIsNone(result)
开发者ID:ecalifornica,项目名称:pyiso,代码行数:5,代码来源:test_base.py
示例12: test_handle_options_set_forecast
def test_handle_options_set_forecast(self):
bc = BaseClient()
start = datetime(2020, 5, 26, 0, 0, tzinfo=pytz.utc)
bc.handle_options(start_at=start, end_at=start+timedelta(days=2))
self.assertTrue(bc.options['forecast'])
开发者ID:cnblevins,项目名称:pyiso,代码行数:5,代码来源:test_base.py
注:本文中的pyiso.base.BaseClient类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论