本文整理匯總了Python中gae2django.models.RegressionTestModel.get_by_id方法的典型用法代碼示例。如果您正苦於以下問題:Python RegressionTestModel.get_by_id方法的具體用法?Python RegressionTestModel.get_by_id怎麽用?Python RegressionTestModel.get_by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gae2django.models.RegressionTestModel
的用法示例。
在下文中一共展示了RegressionTestModel.get_by_id方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_by_id
# 需要導入模塊: from gae2django.models import RegressionTestModel [as 別名]
# 或者: from gae2django.models.RegressionTestModel import get_by_id [as 別名]
def test_get_by_id(self):
item1 = TestModel(xstring='test1')
item1.put()
self.assertEqual(TestModel.get_by_id(item1.key().id()), item1)
self.assertEqual(TestModel.get_by_id(-1), None)
self.assertEqual(TestModel.get_by_id([item1.key().id(), -1]),
[item1, None])
item2 = TestModel(xstring='test2')
item2.put()
self.assertEqual(TestModel.get_by_id([item1.key().id(),
item2.key().id()]),
[item1, item2])
item1.delete()
item2.delete()
示例2: test_listproperty_save_restore
# 需要導入模塊: from gae2django.models import RegressionTestModel [as 別名]
# 或者: from gae2django.models.RegressionTestModel import get_by_id [as 別名]
def test_listproperty_save_restore(self):
obj = TestModel()
obj.xlist = ["foo", "bar", "baz"]
obj.save()
tobj = TestModel.get_by_id(obj.key().id())
self.assertEqual(tobj, obj)
self.assertEqual(tobj.xlist, ["foo", "bar", "baz"])
示例3: test_blobproperty_save_restore
# 需要導入模塊: from gae2django.models import RegressionTestModel [as 別名]
# 或者: from gae2django.models.RegressionTestModel import get_by_id [as 別名]
def test_blobproperty_save_restore(self):
obj = TestModel()
obj.blob = db.Blob("test")
obj.save()
tobj = TestModel.get_by_id(obj.key().id())
self.assertEqual(tobj, obj)
self.assertEqual(obj.blob, "test")
self.assertEqual(tobj.blob, "test")
self.assert_(isinstance(tobj.blob, db.Blob))