本文整理汇总了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)
示例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)
示例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)
示例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)