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


Python IonObject.max_datetime方法代码示例

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


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

示例1: _do_test

# 需要导入模块: from pyon.core.bootstrap import IonObject [as 别名]
# 或者: from pyon.core.bootstrap.IonObject import max_datetime [as 别名]

#.........这里部分代码省略.........
            ]
        }
        pok_contact_info_obj = IonObject('ContactInformation', pok_contact_info)
        pok_user_info = {
            "name": "Per-Olov Kindgren",
            "contact": pok_contact_info_obj
        }
        pok_user_info_obj = IonObject('UserInfo', pok_user_info)
        pok_user_info_tuple = data_store.create(pok_user_info_obj)
        self.assertTrue(len(pok_user_info_tuple) == 2)

        # List all objects in data store and confirm there are six docs
        res = data_store.list_objects()
        # There are indices. Therefore can't could all docs
        self.assertTrue(len(res) == 6 + numcoredocs)

        # Find all the UserInfo records
        res = data_store.find([["type_", "==", "UserInfo"]])
        self.assertTrue(len(res) == 3)

        # Find only the UserInfo record for user Heitor Villa-Lobos
        res = data_store.find([["type_", DataStore.EQUAL, "UserInfo"], DataStore.AND, ["name", DataStore.EQUAL, "Heitor Villa-Lobos"]])
        self.assertTrue(len(res) == 1)
        user_info_obj = res[0]
        self.assertTrue(user_info_obj.contact.name == "Heitor Villa-Lobos")

        # Create an Ion object with default values set (if any)
        data_set = IonObject('DataSet')
        self.assertTrue(isinstance(data_set, interface.objects.DataSet))

        # Assign values to object fields
        data_set.description = "Real-time water data for Choptank River near Greensboro, MD"
        data_set.min_datetime = "2011-08-04T13:15:00Z"
        data_set.max_datetime = "2011-08-09T19:15:00Z"
        data_set.variables = [
                {"name":"water_height", "value":"ft"}
        ]
        data_set.contact.name = "Heitor Villa-Lobos"
        data_set.last_modified = "Heitor Villa-Lobos"

        # Write DataSet object"
        write_tuple_1 = data_store.create(data_set)
        self.assertTrue(len(write_tuple_1) == 2)

        # Save off the object UUID
        data_set_uuid = write_tuple_1[0]

        # Read back the HEAD version of the object and validate fields
        data_set_read_obj = data_store.read(data_set_uuid)
        self.assertTrue(data_set_read_obj._id == data_set_uuid)
        self.assertTrue(isinstance(data_set_read_obj, interface.objects.DataSet))
        self.assertTrue(data_set_read_obj.description == "Real-time water data for Choptank River near Greensboro, MD")
        self.assertTrue(not 'type_' in data_set_read_obj)

        # Update DataSet's Description field and write
        data_set_read_obj.description = "Updated Description"
        write_tuple_2 = data_store.update(data_set_read_obj)
        self.assertTrue(len(write_tuple_2) == 2)

        # Retrieve the updated DataSet
        data_set_read_obj_2 = data_store.read(data_set_uuid)
        self.assertTrue(data_set_read_obj_2._id == data_set_uuid)
        self.assertTrue(data_set_read_obj_2.description == "Updated Description")

        # List all the revisions of DataSet in data store, should be two
        res = data_store.list_object_revisions(data_set_uuid)
开发者ID:blazetopher,项目名称:pyon,代码行数:70,代码来源:test_datastores.py


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