本文整理汇总了Python中gae2django.models.RegressionTestModel.save方法的典型用法代码示例。如果您正苦于以下问题:Python RegressionTestModel.save方法的具体用法?Python RegressionTestModel.save怎么用?Python RegressionTestModel.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gae2django.models.RegressionTestModel
的用法示例。
在下文中一共展示了RegressionTestModel.save方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_listproperty_save_restore
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import save [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"])
示例2: test_filter_unicode
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import save [as 别名]
def test_filter_unicode(self): # issue22
# This test passes with Python >= 2.6 either way.
obj = TestModel()
obj.xstring = 'foo'
obj.save()
query = db.GqlQuery((u'SELECT * FROM RegressionTestModel'
u' WHERE xstring = :foo'), foo=u'foo')
self.assertEqual(query.count(), 1)
示例3: test_blobproperty_save_restore
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import save [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))
示例4: test_auto_current_user_add
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import save [as 别名]
def test_auto_current_user_add(self):
c = Client()
c.login(username='test', password='testpw')
response = c.get('/')
user = response.context['user']
self.assert_(user is not None)
obj = TestModel()
obj.save()
self.assertEqual(obj.xuser, user)
示例5: test_user_property_patched
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import save [as 别名]
def test_user_property_patched(self):
c = Client()
c.login(username='test', password='testpw')
response = c.get('/')
user = response.context['user']
obj = TestModel()
obj.save()
self.assert_(callable(obj.xuser.email))
self.assert_(hasattr(obj.xuser, 'nickname'))
self.assert_(callable(obj.xuser.nickname))
示例6: test_query_listproperty
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import save [as 别名]
def test_query_listproperty(self):
obj = TestModel()
obj.xlist = ['foo', 'bar', 'baz']
obj.save()
query = db.GqlQuery(('SELECT * FROM RegressionTestModel'
' WHERE xlist = :1'), 'foo')
self.assertEqual([obj], list(query))
self.assertEqual(query.count(), 1)
tobj = query.get()
self.assertEqual(tobj.xlist, ['foo', 'bar', 'baz'])
query = db.GqlQuery(('SELECT * FROM RegressionTestModel'
' WHERE xlist = :1'), 'nomatch')
self.assertEqual([], list(query))
self.assertEqual(query.count(), 0)
tobj.xlist = ['bar', 'baz']
tobj.save()
query = db.GqlQuery(('SELECT * FROM RegressionTestModel'
' WHERE xlist = :1'), 'foo')
self.assertEqual([], list(query))
self.assertEqual(query.count(), 0)
示例7: setUp
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import save [as 别名]
def setUp(self):
TestModel.objects.all().delete()
for i in range(10):
obj = TestModel()
obj.xstring = 'foo%d' % i
obj.save()
示例8: test_dbwrite
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import save [as 别名]
def test_dbwrite(self):
# Note: This test mainly makes sense with PostgreSQL backend.
obj = RegressionTestModel()
obj.xstring = CallableString(u"möhrenbrei")
obj.save()