当前位置: 首页>>代码示例>>Python>>正文


Python DataManager._assert_axioms方法代码示例

本文整理汇总了Python中iris._data_manager.DataManager._assert_axioms方法的典型用法代码示例。如果您正苦于以下问题:Python DataManager._assert_axioms方法的具体用法?Python DataManager._assert_axioms怎么用?Python DataManager._assert_axioms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iris._data_manager.DataManager的用法示例。


在下文中一共展示了DataManager._assert_axioms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Test__assert_axioms

# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import _assert_axioms [as 别名]
class Test__assert_axioms(tests.IrisTest):
    def setUp(self):
        self.real_array = np.array(0)
        self.lazy_array = as_lazy_data(self.real_array)
        self.dm = DataManager(self.real_array)

    def test_array_none(self):
        self.dm._real_array = None
        emsg = 'Unexpected data state, got no lazy and no real data'
        with self.assertRaisesRegexp(AssertionError, emsg):
            self.dm._assert_axioms()

    def test_array_all(self):
        self.dm._lazy_array = self.lazy_array
        emsg = 'Unexpected data state, got lazy and real data'
        with self.assertRaisesRegexp(AssertionError, emsg):
            self.dm._assert_axioms()
开发者ID:dennissergeev,项目名称:iris,代码行数:19,代码来源:test_DataManager.py

示例2: Test__assert_axioms

# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import _assert_axioms [as 别名]
class Test__assert_axioms(tests.IrisTest):
    def setUp(self):
        self.real_array = np.array(0)
        self.lazy_array = as_lazy_data(self.real_array)
        self.dm = DataManager(self.real_array)

    def test_array_none(self):
        self.dm._real_array = None
        emsg = 'Unexpected data state, got no lazy and no real data'
        with self.assertRaisesRegexp(AssertionError, emsg):
            self.dm._assert_axioms()

    def test_array_all(self):
        self.dm._lazy_array = self.lazy_array
        emsg = 'Unexpected data state, got lazy and real data'
        with self.assertRaisesRegexp(AssertionError, emsg):
            self.dm._assert_axioms()

    def test_realised_dtype(self):
        self.dm._realised_dtype = np.dtype('float')
        emsg = 'Unexpected realised dtype state, got dtype'
        with self.assertRaisesRegexp(AssertionError, emsg):
            self.dm._assert_axioms()

    def test_real_array_with_realised_dtype(self):
        self.dm._realised_dtype = np.dtype('int')
        emsg = ("Unexpected real data with realised dtype, got "
                "real data and realised dtype\('int64'\)")
        with self.assertRaisesRegexp(AssertionError, emsg):
            self.dm._assert_axioms()

    def test_non_float_lazy_array_with_realised_dtype(self):
        self.dm._real_array = None
        self.dm._lazy_array = self.lazy_array
        self.dm._realised_dtype = np.dtype('int')
        emsg = ("Unexpected lazy data dtype with realised dtype, got "
                "lazy data dtype\('int64'\) and realised "
                "dtype\('int64'\)")
        with self.assertRaisesRegexp(AssertionError, emsg):
            self.dm._assert_axioms()
开发者ID:cpelley,项目名称:iris,代码行数:42,代码来源:test_DataManager.py


注:本文中的iris._data_manager.DataManager._assert_axioms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。