Ejemplo n.º 1
0
def test_calculate_not_slow_down_when_circling_the_road():
    my_car = Car()
    car_in_front = Car()
    my_car.speed = 30
    my_car.location = 980
    car_in_front.speed = 25
    car_in_front.location = 20
    assert my_car.calculate_slow_down(car_in_front) == False
Ejemplo n.º 2
0
def test_calculate_slow_down():
    my_car = Car()
    car_in_front = Car()
    my_car.speed = 30
    my_car.location = 80
    car_in_front.speed = 25
    car_in_front.location = 100
    assert my_car.calculate_slow_down(car_in_front) == True
Ejemplo n.º 3
0
def test_car_that_has_looped_does_not_make_car_behind_slow_down():
    car1 = Car()
    car2 = Car()
    car1.speed = 25
    car2.speed = 27
    car1.location = 15
    car2.location = 980
    assert car2.calculate_slowdown(car1) == False
Ejemplo n.º 4
0
def test_car_that_has_looped_still_makes_car_behind_slow_down():
    car1 = Car()
    car2 = Car()
    car1.speed = 25
    car2.speed = 27
    car1.location = 2
    car2.location = 980
    assert car2.calculate_slowdown(car1) == True
Ejemplo n.º 5
0
def test_car_does_not_slow_down():
    car1 = Car()
    car2 = Car()
    car1.speed = 25
    car2.speed = 27
    car1.location = 115
    car2.location = 80
    assert car2.calculate_slowdown(car1) == False
Ejemplo n.º 6
0
def test_car_decides_to_slow_down():
    car1 = Car()
    car2 = Car()
    car1.speed = 25
    car2.speed = 27
    car1.location = 100
    car2.location = 80
    assert car2.calculate_slowdown(car1) == True