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


Python Guid.save方法代码示例

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


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

示例1: TestFindGuidsWithoutReferents

# 需要导入模块: from framework.guid.model import Guid [as 别名]
# 或者: from framework.guid.model.Guid import save [as 别名]
class TestFindGuidsWithoutReferents(OsfTestCase):

    def setUp(self):
        super(TestFindGuidsWithoutReferents, self).setUp()
        self.node = NodeFactory()
        self.nontarget_guid= Guid(referent=self.node)
        self.nontarget_guid.save()

    def test_get_targets_referent_is_none(self):
        bad_guid = Guid(referent=None)
        bad_guid.save()

        targets = list(get_targets())
        assert_in(bad_guid, targets)
        assert_not_in(self.nontarget_guid, targets)

    def test_get_targets_referent_points_to_nothing(self):
        node = NodeFactory()
        bad_guid = Guid(referent=node)
        bad_guid.save()
        Node.remove(Q('_id', 'eq', node._id))

        targets = list(get_targets())
        assert_in(bad_guid, targets)
        assert_not_in(self.nontarget_guid, targets)
开发者ID:AndrewSallans,项目名称:osf.io,代码行数:27,代码来源:find_guids_without_referents.py

示例2: test_get_targets_referent_is_none

# 需要导入模块: from framework.guid.model import Guid [as 别名]
# 或者: from framework.guid.model.Guid import save [as 别名]
    def test_get_targets_referent_is_none(self):
        bad_guid = Guid(referent=None)
        bad_guid.save()

        targets = list(get_targets())
        assert_in(bad_guid, targets)
        assert_not_in(self.nontarget_guid, targets)
开发者ID:AndrewSallans,项目名称:osf.io,代码行数:9,代码来源:find_guids_without_referents.py

示例3: test_get_targets_referent_points_to_nothing

# 需要导入模块: from framework.guid.model import Guid [as 别名]
# 或者: from framework.guid.model.Guid import save [as 别名]
    def test_get_targets_referent_points_to_nothing(self):
        node = NodeFactory()
        bad_guid = Guid(referent=node)
        bad_guid.save()
        Node.remove(Q('_id', 'eq', node._id))

        targets = list(get_targets())
        assert_in(bad_guid, targets)
        assert_not_in(self.nontarget_guid, targets)
开发者ID:AndrewSallans,项目名称:osf.io,代码行数:11,代码来源:find_guids_without_referents.py

示例4: TestMigrateLegacyTagGUIDObjects

# 需要导入模块: from framework.guid.model import Guid [as 别名]
# 或者: from framework.guid.model.Guid import save [as 别名]
class TestMigrateLegacyTagGUIDObjects(OsfTestCase):

    def setUp(self):
        OsfTestCase.setUp(self)
        tag = TagFactory()
        self.target_guid = Guid(referent=tag)
        self.target_guid.save()
        self.nontarget_guid = Guid(referent=NodeFactory())

    def test_get_targets(self):
        result = list(get_targets())
        assert_in(self.target_guid, result)
        assert_not_in(self.nontarget_guid, result)

    def test_do_migration(self):
        # sanity check
        assert_equal(len(list(get_targets())), 1)
        do_migration()
        assert_equal(len(list(get_targets())), 0)
开发者ID:545zhou,项目名称:osf.io,代码行数:21,代码来源:fix_tag_guids.py


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