Beispiel #1
0
def test_can_return_length():
    jogs = Jog(10)
    assert jogs.chain_length() == 1

    jogs.next_action = Walk(10)

    assert jogs.chain_length() == 2
Beispiel #2
0
def test_can_chain_activities():
    workout = Walk(600, Jog(60, Walk(60, Jog(60, Walk(60, Jog(60))))))

    assert workout.name == "walk"
    assert workout.next_action.name == "jog"
    last = workout.next_action.next_action.next_action.next_action.next_action
    assert last.next_action == None
def test_can_return_length():
    jogs = Jog(10)
    assert jogs.chain_length() == 1

    jogs.next_action = Walk(10)

    assert jogs.chain_length() == 2
def test_week_one_workout():
    gen = WorkoutGenerator(1, 1)
    actual = gen.get_workout()

    expected = Walk(300)
    expected.add_to_tail(Jog(60, Walk(90)))
    expected.add_to_tail(Jog(60, Walk(90)))
    expected.add_to_tail(Jog(60, Walk(90)))
    expected.add_to_tail(Jog(60, Walk(90)))
    expected.add_to_tail(Jog(60, Walk(90)))
    expected.add_to_tail(Jog(60, Walk(90)))
    expected.add_to_tail(Jog(60, Walk(90)))
    expected.add_to_tail(Jog(60, Walk(90)))

    validate_workout(expected, actual)
def test_week_two_workout():
    gen = WorkoutGenerator(2, 1)
    actual = gen.get_workout()

    expected = Walk(300, Jog(90, Walk(120)))
    expected.add_to_tail(Jog(90, Walk(120)))
    expected.add_to_tail(Jog(90, Walk(120)))
    expected.add_to_tail(Jog(90, Walk(120)))
    expected.add_to_tail(Jog(90, Walk(120)))
    expected.add_to_tail(Jog(90, Walk(60)))

    validate_workout(expected, actual)
Beispiel #6
0
def test_can_add_to_tail():
    jogs = Jog(10, Jog(10, Jog(10)))
    jogs.add_to_tail(Walk(30))
    assert jogs.next_action.next_action.next_action.name == "walk"
Beispiel #7
0
def test_jog_is_syntactic_sugar():
    jog = Jog(10)
    assert jog.name == "jog"
def test_can_add_to_tail():
    jogs = Jog(10, Jog(10, Jog(10)))
    jogs.add_to_tail(Walk(30))
    assert jogs.next_action.next_action.next_action.name == "walk"