本文整理汇总了Python中car.Car.change_position方法的典型用法代码示例。如果您正苦于以下问题:Python Car.change_position方法的具体用法?Python Car.change_position怎么用?Python Car.change_position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类car.Car
的用法示例。
在下文中一共展示了Car.change_position方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_road_curve
# 需要导入模块: from car import Car [as 别名]
# 或者: from car.Car import change_position [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 change_position [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 change_position [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
示例4: test_move_car_end_of_track
# 需要导入模块: from car import Car [as 别名]
# 或者: from car.Car import change_position [as 别名]
def test_move_car_end_of_track():
test_car = Car(990)
test_car.speed = 30
test_car.change_position()
assert test_car.car_coordinates[0] == 20
assert test_car.car_coordinates[-1] == 24
示例5: test_move_car
# 需要导入模块: from car import Car [as 别名]
# 或者: from car.Car import change_position [as 别名]
def test_move_car():
test_car = Car(1)
test_car.speed = 2
test_car.change_position()
assert test_car.car_coordinates[0] == 2
assert test_car.car_coordinates[-1] == 6