本文整理汇总了Python中application.models.Cell.all方法的典型用法代码示例。如果您正苦于以下问题:Python Cell.all方法的具体用法?Python Cell.all怎么用?Python Cell.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.models.Cell
的用法示例。
在下文中一共展示了Cell.all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_non_existing_cell
# 需要导入模块: from application.models import Cell [as 别名]
# 或者: from application.models.Cell import all [as 别名]
def test_create_non_existing_cell(self):
rv = self.app.post('/api/v0/report/' + str(self.r.key()) + '/cell/2_1_0/polygon',
data='{"paths": "test", "type": 1}'
)
self.assertEquals(2, Area.all().count())
self.assertEquals(4, Cell.all().count())
# check parents exists
cell = Cell.all().filter('report =', self.r).filter('x =', 1).filter('y =', 0).filter('z =', 2).fetch(1)[0]
self.assertEquals('test', cell.get_parent().last_change_by.nickname())
self.assertEquals('test', cell.get_parent().get_parent().last_change_by.nickname())
self.assertNotEquals(0, cell.get_parent().last_change_on)
示例2: setUp
# 需要导入模块: from application.models import Cell [as 别名]
# 或者: from application.models.Cell import all [as 别名]
def setUp(self):
for x in models.CELL_BLACK_LIST[:]:
models.CELL_BLACK_LIST.pop()
app.config['TESTING'] = True
self.login('[email protected]', 'testuser')
self.app = app.test_client()
for x in Cell.all():
x.delete()
r = Report(start=date.today(), finished=False)
r.put()
self.r = r
示例3: test_update_cell_2_0_1
# 需要导入模块: from application.models import Cell [as 别名]
# 或者: from application.models.Cell import all [as 别名]
def test_update_cell_2_0_1(self):
rv = self.app.put('/api/v0/report/' + str(self.r.key())+'/cell/2_1_3',
data='{"ndfi_low": 0.0, "ndfi_high": 1.0, "done": false}'
)
self.assertEquals(200, rv.status_code)
js = json.loads(rv.data)
q = Cell.all()
q.filter("z =", 2)
q.filter("x =", 1)
q.filter("y =", 3)
q.filter("report =", self.r)
cell = q.fetch(1)[0]
self.assertAlmostEquals(0, cell.ndfi_low)
self.assertAlmostEquals(1.0, cell.ndfi_high)
self.assertEquals('test', cell.get_parent().last_change_by.nickname())
self.assertEquals('test', cell.get_parent().get_parent().last_change_by.nickname())
self.assertNotEquals(0, cell.get_parent().last_change_on)