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