本文整理汇总了Python中indico.modules.rb.models.locations.Location.getDefaultLocation方法的典型用法代码示例。如果您正苦于以下问题:Python Location.getDefaultLocation方法的具体用法?Python Location.getDefaultLocation怎么用?Python Location.getDefaultLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.rb.models.locations.Location
的用法示例。
在下文中一共展示了Location.getDefaultLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testClone
# 需要导入模块: from indico.modules.rb.models.locations import Location [as 别名]
# 或者: from indico.modules.rb.models.locations.Location import getDefaultLocation [as 别名]
def testClone(self):
original = Location.getDefaultLocation()
cloned = utils.clone(Location, original)
assert cloned.id != original.id
assert cloned.name == original.name
assert cloned.default_aspect.id == original.default_aspect.id
示例2: testSetDefaultLocation
# 需要导入模块: from indico.modules.rb.models.locations import Location [as 别名]
# 或者: from indico.modules.rb.models.locations.Location import getDefaultLocation [as 别名]
def testSetDefaultLocation(self):
if len(LOCATIONS) < 2:
raise RuntimeWarning('Not enough locations for tis test,'
' there should be at least 2 locations')
else:
old_default = Location.getDefaultLocation()
name = None
for l, loc in self.iterLocations():
if not loc.is_default:
Location.setDefaultLocation(loc)
db.session.commit()
name = l['name']
self.assertTrue(loc.is_default)
break
assert name == Location.getDefaultLocation().name
# revert change to decrease dependency between tests
Location.setDefaultLocation(old_default)
db.session.commit()
示例3: testGetDefaultLocation
# 需要导入模块: from indico.modules.rb.models.locations import Location [as 别名]
# 或者: from indico.modules.rb.models.locations.Location import getDefaultLocation [as 别名]
def testGetDefaultLocation(self):
for l, loc in self.iterLocations():
if 'is_default' in l:
assert loc == Location.getDefaultLocation()