Beispiel #1
0
def test_decorator_api():
    """The new API."""
    def curl_func(week):
        return "{} x 10".format(week)

    # Create a 4-week program
    program = Program("My first program!", duration=8)

    with program.Day():

        program.DynamicExercise("Bench press", 60, 65)
        program.DynamicExercise("Squats", 80, 85)
        program.StaticExercise("Curls", curl_func)

    assert len(program.days) == 1
    assert len(program.days[0].dynamic_exercises) == 2
    assert len(program.days[0].static_exercises) == 1

    assert program.days[0].program is not None
    assert program.days[0].dynamic_exercises[0].day is not None

    assert not program._rendered
    program.render()
    assert program._rendered
Beispiel #2
0
    program = Program(
        # The name of the training program
        name="Beginner 5x5",
        # The duration of the training program in weeks.
        duration=4,
        # The baseline number of repetitions per dynamic exercise.
        # reps_per_exercise=25,
        intensity=reps_to_intensity(5),
        # Units for the weights, typically 'kg', 'lbs' or '' (empty)
        units="kg",
        # What the weights are rounded to.
        round_to=2.5,
        rep_scaler_func=[1, 1, 1, 1],
        intensity_scaler_func=intensity_scaler_func,
    )

    with program.Day("A"):
        program.DynamicExercise(name="Squat",
                                start_weight=100,
                                min_reps=5,
                                max_reps=5)
        program.StaticExercise("Biceps", "4 x 10")

    program.render()

    from pprint import pprint

    # pprint(program.to_dict())

    # print(program)