本文整理汇总了Python中models.Session.new_lap方法的典型用法代码示例。如果您正苦于以下问题:Python Session.new_lap方法的具体用法?Python Session.new_lap怎么用?Python Session.new_lap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Session
的用法示例。
在下文中一共展示了Session.new_lap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestSession
# 需要导入模块: from models import Session [as 别名]
# 或者: from models.Session import new_lap [as 别名]
class TestSession(unittest.TestCase):
def setUp(self):
self.session = Session()
def test_new_lap(self):
self.assertEqual(self.session.current_lap, None)
self.session.new_lap(0)
self.session.current_lap.laptime = 6000
# Check best_lap is set correctly:
self.session.new_lap(1)
self.assertEqual(self.session.best_lap.laptime, 6000)
# Add slower lap
self.session.current_lap.laptime = 8000
self.session.new_lap(2)
# Check best_lap is still correct
self.assertEqual(self.session.best_lap.laptime, 6000)
# Add faster lap
self.session.current_lap.laptime = 5500
self.session.new_lap(3)
# Check best_lap has been updated
self.assertEqual(self.session.best_lap.laptime, 5500)
示例2: acMain
# 需要导入模块: from models import Session [as 别名]
# 或者: from models.Session import new_lap [as 别名]
def acMain(ac_version):
global session
# Create session object
session = Session(ac, acsys)
session.app_size_x = app_size_x
session.app_size_y = app_size_y
session.freq = FREQ
session.trackname = ac.getTrackName(0)
session.carname = ac.getCarName(0)
# Initialise UI:
ui = UI(session)
session.ui = ui
# Load best lap time if it exists for current track and car
session.load_best_lap()
# Create first lap
session.new_lap(ac.getCarState(0, acsys.CS.LapCount))
return "Racing Line"