当前位置: 首页>>代码示例>>Python>>正文


Python Car.set_new_speed方法代码示例

本文整理汇总了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
开发者ID:gregajohnston,项目名称:traffic-simulation,代码行数:14,代码来源:tests.py

示例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
开发者ID:gregajohnston,项目名称:traffic-simulation,代码行数:15,代码来源:tests.py

示例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
开发者ID:gregajohnston,项目名称:traffic-simulation,代码行数:15,代码来源:tests.py


注:本文中的car.Car.set_new_speed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。