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


Python iris.Future類代碼示例

本文整理匯總了Python中iris.Future的典型用法代碼示例。如果您正苦於以下問題:Python Future類的具體用法?Python Future怎麽用?Python Future使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Future類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_valid_clip_latitudes

 def test_valid_clip_latitudes(self):
     future = Future()
     new_value = not future.clip_latitudes
     msg = "'Future' property 'clip_latitudes' is deprecated"
     with self.assertWarnsRegexp(msg):
         future.clip_latitudes = new_value
     self.assertEqual(future.clip_latitudes, new_value)
開發者ID:SciTools,項目名稱:iris,代碼行數:7,代碼來源:test_Future.py

示例2: test_invalid_arg

 def test_invalid_arg(self):
     future = Future()
     with self.assertRaises(AttributeError):
         with future.context(this_does_not_exist=True):
             # Don't need to do anything here... the context manager
             # will (assuming it's working!) have already raised the
             # exception we're looking for.
             pass
開發者ID:MahatmaCane,項目名稱:iris,代碼行數:8,代碼來源:test_Future.py

示例3: test_no_args

 def test_no_args(self):
     future = Future(cell_datetime_objects=False)
     self.assertFalse(future.cell_datetime_objects)
     with future.context():
         self.assertFalse(future.cell_datetime_objects)
         future.cell_datetime_objects = True
         self.assertTrue(future.cell_datetime_objects)
     self.assertFalse(future.cell_datetime_objects)
開發者ID:MahatmaCane,項目名稱:iris,代碼行數:8,代碼來源:test_Future.py

示例4: test_cell_datetime_objects

 def test_cell_datetime_objects(self):
     future = Future()
     new_value = not future.cell_datetime_objects
     with warnings.catch_warnings(record=True) as warn:
         warnings.simplefilter('always')
         future.cell_datetime_objects = new_value
     self.assertEqual(future.cell_datetime_objects, new_value)
     exp_wmsg = "'Future' property 'cell_datetime_objects' is deprecated"
     six.assertRegex(self, str(warn[0]), exp_wmsg)
開發者ID:SciTools,項目名稱:iris,代碼行數:9,代碼來源:test_Future.py

示例5: test_with_arg

 def test_with_arg(self):
     # Catch the deprecation when explicitly setting `cell_datetime_objects`
     # as the test is still useful even though the Future property is
     # deprecated.
     with warnings.catch_warnings():
         warnings.simplefilter('ignore')
         future = Future(cell_datetime_objects=False)
         self.assertFalse(future.cell_datetime_objects)
         with future.context(cell_datetime_objects=True):
             self.assertTrue(future.cell_datetime_objects)
         self.assertFalse(future.cell_datetime_objects)
開發者ID:SciTools,項目名稱:iris,代碼行數:11,代碼來源:test_Future.py

示例6: test_exception

    def test_exception(self):
        # Check that an interrupted context block restores the initial state.
        class LocalTestException(Exception):
            pass

        future = Future(cell_datetime_objects=False)
        try:
            with future.context(cell_datetime_objects=True):
                raise LocalTestException()
        except LocalTestException:
            pass
        self.assertEqual(future.cell_datetime_objects, False)
開發者ID:MahatmaCane,項目名稱:iris,代碼行數:12,代碼來源:test_Future.py

示例7: test_exception

    def test_exception(self):
        # Check that an interrupted context block restores the initial state.
        class LocalTestException(Exception):
            pass

        # Catch the deprecation when explicitly setting `cell_datetime_objects`
        # as the test is still useful even though the Future property is
        # deprecated.
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            future = Future(cell_datetime_objects=False)
            try:
                with future.context(cell_datetime_objects=True):
                    raise LocalTestException()
            except LocalTestException:
                pass
            self.assertEqual(future.cell_datetime_objects, False)
開發者ID:SciTools,項目名稱:iris,代碼行數:17,代碼來源:test_Future.py

示例8: test_invalid_attribute

 def test_invalid_attribute(self):
     future = Future()
     with self.assertRaises(AttributeError):
         future.numberwang = 7
開發者ID:MahatmaCane,項目名稱:iris,代碼行數:4,代碼來源:test_Future.py

示例9: test_valid_clip_latitudes

 def test_valid_clip_latitudes(self):
     future = Future()
     new_value = not future.clip_latitudes
     future.clip_latitudes = new_value
     self.assertEqual(future.clip_latitudes, new_value)
開發者ID:MahatmaCane,項目名稱:iris,代碼行數:5,代碼來源:test_Future.py

示例10: test_valid_strict_grib_load

 def test_valid_strict_grib_load(self):
     future = Future()
     new_value = not future.strict_grib_load
     future.strict_grib_load = new_value
     self.assertEqual(future.strict_grib_load, new_value)
開發者ID:MahatmaCane,項目名稱:iris,代碼行數:5,代碼來源:test_Future.py

示例11: test_valid_cell_datetime_objects

 def test_valid_cell_datetime_objects(self):
     future = Future()
     new_value = not future.cell_datetime_objects
     future.cell_datetime_objects = new_value
     self.assertEqual(future.cell_datetime_objects, new_value)
開發者ID:MahatmaCane,項目名稱:iris,代碼行數:5,代碼來源:test_Future.py

示例12: test_valid_netcdf_no_unlimited

 def test_valid_netcdf_no_unlimited(self):
     future = Future()
     new_value = not future.netcdf_no_unlimited
     future.netcdf_no_unlimited = new_value
     self.assertEqual(future.netcdf_no_unlimited, new_value)
開發者ID:MahatmaCane,項目名稱:iris,代碼行數:5,代碼來源:test_Future.py

示例13: test_invalid_netcdf_no_unlimited

 def test_invalid_netcdf_no_unlimited(self):
     future = Future()
     exp_emsg = \
         "'Future' property 'netcdf_no_unlimited' has been deprecated"
     with self.assertRaisesRegexp(AttributeError, exp_emsg):
         future.netcdf_no_unlimited = False
開發者ID:SciTools,項目名稱:iris,代碼行數:6,代碼來源:test_Future.py

示例14: test_netcdf_no_unlimited

 def test_netcdf_no_unlimited(self):
     future = Future()
     exp_emsg = "'Future' property 'netcdf_no_unlimited' is deprecated"
     with self.assertWarnsRegexp(exp_emsg):
         future.netcdf_no_unlimited = True
開發者ID:SciTools,項目名稱:iris,代碼行數:5,代碼來源:test_Future.py

示例15: test_invalid_netcdf_promote

 def test_invalid_netcdf_promote(self):
     future = Future()
     exp_emsg = "'Future' property 'netcdf_promote' has been deprecated"
     with self.assertRaisesRegexp(AttributeError, exp_emsg):
         future.netcdf_promote = False
開發者ID:SciTools,項目名稱:iris,代碼行數:5,代碼來源:test_Future.py


注:本文中的iris.Future類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。