本文整理汇总了Python中gae2django.models.RegressionTestModel.all方法的典型用法代码示例。如果您正苦于以下问题:Python RegressionTestModel.all方法的具体用法?Python RegressionTestModel.all怎么用?Python RegressionTestModel.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gae2django.models.RegressionTestModel
的用法示例。
在下文中一共展示了RegressionTestModel.all方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_filter
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import all [as 别名]
def test_filter(self):
q = TestModel.all()
self.assert_(isinstance(q, db.Query))
q = q.filter('xstring =', 'foo1')
self.assert_(isinstance(q, db.Query))
self.assertEqual(len(list(q)), 1)
q = TestModel.all().filter('xstring =', 'foo')
self.assert_(isinstance(q, db.Query))
self.assertEqual(len(list(q)), 0)
示例2: test_ancestor
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import all [as 别名]
def test_ancestor(self):
grandpa = TestModel.get_or_insert('grandpa')
dad = TestModel.get_or_insert('dad', parent=grandpa)
TestModel.get_or_insert('junior', parent=dad)
TestModel.get_or_insert('unrelated')
q = TestModel.all()
q.ancestor(grandpa)
self.assertEqual(len(q), 2)
q2 = TestModel.all()
q2.ancestor(dad)
self.assertEqual(len(q2), 1)
示例3: test_refkey
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import all [as 别名]
def test_refkey(self):
# Regression for issue23.
i1 = TestModel2()
i1.put()
i2 = TestModel()
i2.ref = i1
i2.put()
q = TestModel.all()
q.filter('ref =', i1.key())
res = list(q.fetch(1000))
self.assertEqual(len(res), 1)
self.assertEqual(str(res[0].key()), str(i2.key()))
示例4: setUp
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import all [as 别名]
def setUp(self):
TestModel.all().delete()
self.item1 = TestModel(key_name='foo1')
self.item1.put()
示例5: test_all
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import all [as 别名]
def test_all(self):
self.assertEqual(len(TestModel.all()), 1)
item1 = TestModel.get_or_insert('test1')
self.assertEqual(len(TestModel.all()), 2)
self.assert_(item1 in TestModel.all())
item1.delete()
示例6: test_key_only
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import all [as 别名]
def test_key_only(self):
q = TestModel.all(keys_only=True)
res = q.fetch(1000)
self.assertEqual(len(res), 1)
self.assertEqual(res[0], self.item1.id)
示例7: test_query_get_empy
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import all [as 别名]
def test_query_get_empy(self): # issue 11
q = TestModel.all()
q = q.filter('xstring =', 'doesnotexist')
item = q.get()
self.assertEqual(item, None)
示例8: test_query_get
# 需要导入模块: from gae2django.models import RegressionTestModel [as 别名]
# 或者: from gae2django.models.RegressionTestModel import all [as 别名]
def test_query_get(self):
q = TestModel.all()
q = q.filter('xstring =', 'foo1')
item = q.get()
self.assert_(isinstance(item, TestModel))
self.assertEqual(item.xstring, 'foo1')