本文整理匯總了Python中application.models.Area.all方法的典型用法代碼示例。如果您正苦於以下問題:Python Area.all方法的具體用法?Python Area.all怎麽用?Python Area.all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類application.models.Area
的用法示例。
在下文中一共展示了Area.all方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_create
# 需要導入模塊: from application.models import Area [as 別名]
# 或者: from application.models.Area import all [as 別名]
def test_create(self):
rv = self.app.post('/api/v0/report/' + str(self.r.key()) + '/cell/2_0_0/polygon',
data='{"paths": "[]", "type": 1}'
)
self.assertEquals(2, Area.all().count())
rv = self.app.get('/api/v0/report/' + str(self.r.key()) + '/cell/2_0_0/polygon')
js = json.loads(rv.data)
self.assertEquals(2, len(js))
示例2: test_update
# 需要導入模塊: from application.models import Area [as 別名]
# 或者: from application.models.Area import all [as 別名]
def test_update(self):
rv = self.app.put('/api/v0/report/' + str(self.r.key()) + '/cell/2_0_0/polygon/' + str(self.area.key()),
data='{"paths": "[[1, 2, 3]]", "type": 100}'
)
self.assertEquals(1, Area.all().count())
a = Area.get(self.area.key())
self.assertEquals(100, a.type)
self.assertEquals("\"[[1, 2, 3]]\"", a.geo)
js = json.loads(rv.data)
self.assertEquals(100, js['type'])
self.assertEquals("[[1, 2, 3]]", js['paths'])
示例3: test_create_non_existing_cell
# 需要導入模塊: from application.models import Area [as 別名]
# 或者: from application.models.Area 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)
示例4: setUp
# 需要導入模塊: from application.models import Area [as 別名]
# 或者: from application.models.Area import all [as 別名]
def setUp(self):
app.config['TESTING'] = True
self.app = app.test_client()
self.login('[email protected]', 'testuser')
for x in Area.all():
x.delete()
for x in Cell.all():
x.delete()
r = Report(start=date.today(), finished=False)
r.put()
self.r = r
self.cell = Cell(x=0, y=0, z=2, report=self.r, ndfi_high=1.0, ndfi_low=0.0)
self.cell.put()
self.area = Area(geo='[]', added_by=users.get_current_user(), type=1, cell=self.cell)
self.area.put()
示例5: test_delete
# 需要導入模塊: from application.models import Area [as 別名]
# 或者: from application.models.Area import all [as 別名]
def test_delete(self):
rv = self.app.delete('/api/v0/report/' + str(self.r.key()) + '/cell/2_0_0/polygon/' + str(self.area.key()))
self.assertEquals(0, Area.all().count())