當前位置: 首頁>>代碼示例>>Python>>正文


Python base.BaseClient類代碼示例

本文整理匯總了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;未經允許,請勿轉載。