本文整理汇总了Python中car.Car.set_new_speed方法的典型用法代码示例。如果您正苦于以下问题:Python Car.set_new_speed方法的具体用法?Python Car.set_new_speed怎么用?Python Car.set_new_speed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类car.Car
的用法示例。
在下文中一共展示了Car.set_new_speed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_road_curve
# 需要导入模块: from car import Car [as 别名]
# 或者: from car.Car import set_new_speed [as 别名]
def test_road_curve():
test_road = Road(2)
test_car = Car()
test_car.speed = 8
test_car_two = Car(20)
td = test_road.set_tail_distance(test_car, test_car_two)
test_car.set_new_speed(test_car_two, td)
test_car.change_position()
test_road.check_end_of_lap(test_car)
test_car.check_position(test_car_two)
test_road.check_end_of_lap(test_car)
assert test_car.speed == 10
示例2: test_choose_speed_steady_fast
# 需要导入模块: from car import Car [as 别名]
# 或者: from car.Car import set_new_speed [as 别名]
def test_choose_speed_steady_fast():
test_road = Road(2)
test_car = Car()
test_car.speed = 10
test_car_two = Car(14)
test_car_two.speed = 12
td = test_road.set_tail_distance(test_car, test_car_two)
test_car.set_new_speed(test_car_two, td)
test_car.change_position()
test_road.check_end_of_lap(test_car)
test_car.check_position(test_car_two)
test_road.check_end_of_lap(test_car)
assert test_car.speed == 12
示例3: test_choose_speed_stop_please
# 需要导入模块: from car import Car [as 别名]
# 或者: from car.Car import set_new_speed [as 别名]
def test_choose_speed_stop_please():
test_road = Road(2)
test_car = Car(75)
test_car.speed = 12
test_car_two = Car(80)
test_car_two.speed = 2
td = test_road.set_tail_distance(test_car, test_car_two)
test_car.set_new_speed(test_car_two, td)
test_car.change_position()
test_road.check_end_of_lap(test_car)
test_car.check_position(test_car_two)
test_road.check_end_of_lap(test_car)
assert test_car.speed == 0