Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ python -m pytest test_workouts.py
- ============================================================ test session starts ============================================================
- platform linux -- Python 3.8.3, pytest-5.4.2, py-1.8.1, pluggy-0.13.1
- rootdir: /home/<user>/dev/projects/python/2018-and-2020/bitesofpy/Intro-freebies-101-110/inprogress/Bite 109 - Workout dict lookups and raising an exception
- collected 13 items
- test_workouts.py FFFFFFFFFFFFF [100%]
- ================================================================= FAILURES ==================================================================
- ____________________________ test_get_workout_valid_case_insensitive_dict_lookups[Monday-Go train Chest+biceps] _____________________________
- day = 'Monday', expected = 'Go train Chest+biceps'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Go train Chest+biceps'
- E - Go train Chest+biceps
- E + Not a valid day
- test_workouts.py:23: AssertionError
- ____________________________ test_get_workout_valid_case_insensitive_dict_lookups[monday-Go train Chest+biceps] _____________________________
- day = 'monday', expected = 'Go train Chest+biceps'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Go train Chest+biceps'
- E - Go train Chest+biceps
- E + Not a valid day
- test_workouts.py:23: AssertionError
- ____________________________ test_get_workout_valid_case_insensitive_dict_lookups[Tuesday-Go train Back+triceps] ____________________________
- day = 'Tuesday', expected = 'Go train Back+triceps'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Go train Back+triceps'
- E - Go train Back+triceps
- E + Not a valid day
- test_workouts.py:23: AssertionError
- ____________________________ test_get_workout_valid_case_insensitive_dict_lookups[TuEsdAy-Go train Back+triceps] ____________________________
- day = 'TuEsdAy', expected = 'Go train Back+triceps'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Go train Back+triceps'
- E - Go train Back+triceps
- E + Not a valid day
- test_workouts.py:23: AssertionError
- _______________________________ test_get_workout_valid_case_insensitive_dict_lookups[Wednesday-Go train Core] _______________________________
- day = 'Wednesday', expected = 'Go train Core'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Go train Core'
- E - Go train Core
- E + Not a valid day
- test_workouts.py:23: AssertionError
- _______________________________ test_get_workout_valid_case_insensitive_dict_lookups[wednesdaY-Go train Core] _______________________________
- day = 'wednesdaY', expected = 'Go train Core'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Go train Core'
- E - Go train Core
- E + Not a valid day
- test_workouts.py:23: AssertionError
- _______________________________ test_get_workout_valid_case_insensitive_dict_lookups[Thursday-Go train Legs] ________________________________
- day = 'Thursday', expected = 'Go train Legs'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Go train Legs'
- E - Go train Legs
- E + Not a valid day
- test_workouts.py:23: AssertionError
- ______________________________ test_get_workout_valid_case_insensitive_dict_lookups[Friday-Go train Shoulders] ______________________________
- day = 'Friday', expected = 'Go train Shoulders'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Go train Shoulders'
- E - Go train Shoulders
- E + Not a valid day
- test_workouts.py:23: AssertionError
- _________________________________ test_get_workout_valid_case_insensitive_dict_lookups[Saturday-Chill out!] _________________________________
- day = 'Saturday', expected = 'Chill out!'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Chill out!'
- E - Chill out!
- E + Not a valid day
- test_workouts.py:23: AssertionError
- __________________________________ test_get_workout_valid_case_insensitive_dict_lookups[Sunday-Chill out!] __________________________________
- day = 'Sunday', expected = 'Chill out!'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Chill out!'
- E - Chill out!
- E + Not a valid day
- test_workouts.py:23: AssertionError
- __________________________________ test_get_workout_valid_case_insensitive_dict_lookups[sundAy-Chill out!] __________________________________
- day = 'sundAy', expected = 'Chill out!'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- E AssertionError: assert 'Not a valid day' == 'Chill out!'
- E - Chill out!
- E + Not a valid day
- test_workouts.py:23: AssertionError
- ______________________________ test_get_workout_valid_case_insensitive_dict_lookups[nonsense-Not a valid day] _______________________________
- day = 'nonsense', expected = 'Not a valid day'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- test_workouts.py:23:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- day = 'nonsense'
- def get_workout_motd(day):
- > if WORKOUT_SCHEDULE[day.capitalize()] == ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'):
- E KeyError: 'Nonsense'
- workouts1.py:16: KeyError
- _______________________________ test_get_workout_valid_case_insensitive_dict_lookups[monday2-Not a valid day] _______________________________
- day = 'monday2', expected = 'Not a valid day'
- @pytest.mark.parametrize("day, expected", [
- ('Monday', 'Go train Chest+biceps'),
- ('monday', 'Go train Chest+biceps'),
- ('Tuesday', 'Go train Back+triceps'),
- ('TuEsdAy', 'Go train Back+triceps'),
- ('Wednesday', 'Go train Core'),
- ('wednesdaY', 'Go train Core'),
- ('Thursday', 'Go train Legs'),
- ('Friday', 'Go train Shoulders'),
- ('Saturday', CHILL_OUT),
- ('Sunday', CHILL_OUT),
- ('sundAy', CHILL_OUT),
- ('nonsense', INVALID_DAY),
- ('monday2', INVALID_DAY),
- ])
- def test_get_workout_valid_case_insensitive_dict_lookups(day, expected):
- > assert get_workout_motd(day) == expected
- test_workouts.py:23:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- day = 'monday2'
- def get_workout_motd(day):
- > if WORKOUT_SCHEDULE[day.capitalize()] == ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'):
- E KeyError: 'Monday2'
- workouts1.py:16: KeyError
- ========================================================== short test summary info ==========================================================
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[Monday-Go train Chest+biceps] - AssertionError: assert 'Not ...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[monday-Go train Chest+biceps] - AssertionError: assert 'Not ...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[Tuesday-Go train Back+triceps] - AssertionError: assert 'Not...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[TuEsdAy-Go train Back+triceps] - AssertionError: assert 'Not...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[Wednesday-Go train Core] - AssertionError: assert 'Not a val...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[wednesdaY-Go train Core] - AssertionError: assert 'Not a val...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[Thursday-Go train Legs] - AssertionError: assert 'Not a vali...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[Friday-Go train Shoulders] - AssertionError: assert 'Not a v...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[Saturday-Chill out!] - AssertionError: assert 'Not a valid d...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[Sunday-Chill out!] - AssertionError: assert 'Not a valid day...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[sundAy-Chill out!] - AssertionError: assert 'Not a valid day...
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[nonsense-Not a valid day] - KeyError: 'Nonsense'
- FAILED test_workouts.py::test_get_workout_valid_case_insensitive_dict_lookups[monday2-Not a valid day] - KeyError: 'Monday2'
- ============================================================ 13 failed in 0.10s =============================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement