-
Notifications
You must be signed in to change notification settings - Fork 167
Jessica E Ambriz-Madrigal - Lions #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| from viewing_party.party import * | ||
| from tests.test_constants import * | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_create_successful_movie(): | ||
| # Arrange | ||
| movie_title = MOVIE_TITLE_1 | ||
|
|
@@ -19,7 +19,7 @@ def test_create_successful_movie(): | |
| assert new_movie["genre"] == GENRE_1 | ||
| assert new_movie["rating"] == pytest.approx(RATING_1) | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_create_no_title_movie(): | ||
| # Arrange | ||
| movie_title = None | ||
|
|
@@ -32,7 +32,7 @@ def test_create_no_title_movie(): | |
| # Assert | ||
| assert new_movie is None | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_create_no_genre_movie(): | ||
| # Arrange | ||
| movie_title = "Title A" | ||
|
|
@@ -45,7 +45,7 @@ def test_create_no_genre_movie(): | |
| # Assert | ||
| assert new_movie is None | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_create_no_rating_movie(): | ||
| # Arrange | ||
| movie_title = "Title A" | ||
|
|
@@ -58,7 +58,7 @@ def test_create_no_rating_movie(): | |
| # Assert | ||
| assert new_movie is None | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_adds_movie_to_user_watched(): | ||
| # Arrange | ||
| movie = { | ||
|
|
@@ -79,7 +79,7 @@ def test_adds_movie_to_user_watched(): | |
| assert updated_data["watched"][0]["genre"] == GENRE_1 | ||
| assert updated_data["watched"][0]["rating"] == RATING_1 | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_adds_movie_to_user_watchlist(): | ||
| # Arrange | ||
| movie = { | ||
|
|
@@ -100,7 +100,7 @@ def test_adds_movie_to_user_watchlist(): | |
| assert updated_data["watchlist"][0]["genre"] == GENRE_1 | ||
| assert updated_data["watchlist"][0]["rating"] == RATING_1 | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_moves_movie_from_watchlist_to_empty_watched(): | ||
| # Arrange | ||
| janes_data = { | ||
|
|
@@ -119,15 +119,22 @@ def test_moves_movie_from_watchlist_to_empty_watched(): | |
| assert len(updated_data["watchlist"]) == 0 | ||
| assert len(updated_data["watched"]) == 1 | ||
|
|
||
| raise Exception("Test needs to be completed.") | ||
| assert updated_data["watched"][0]["title"] == MOVIE_TITLE_1 | ||
| assert updated_data["watched"][0]["genre"] == GENRE_1 | ||
| assert updated_data["watched"][0]["rating"] == RATING_1 | ||
| # ******************************************************************************************* | ||
| # ****** Add assertions here to test that the correct movie was added to "watched" ********** | ||
| # ******************************************************************************************* | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_moves_movie_from_watchlist_to_watched(): | ||
| # Arrange | ||
| # assign a HORR0R_1 to movie_to_watch | ||
| movie_to_watch = HORROR_1 | ||
| # janes_data is a dictionary that has two key values | ||
| # watchlist | ||
| # watched | ||
| # They each have a list as the value of the keys | ||
| janes_data = { | ||
| "watchlist": [ | ||
| FANTASY_1, | ||
|
|
@@ -143,25 +150,33 @@ def test_moves_movie_from_watchlist_to_watched(): | |
| assert len(updated_data["watchlist"]) == 1 | ||
| assert len(updated_data["watched"]) == 2 | ||
|
|
||
| raise Exception("Test needs to be completed.") | ||
| assert updated_data["watched"][1] == movie_to_watch | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! 👍🏻 |
||
| # ******************************************************************************************* | ||
| # ****** Add assertions here to test that the correct movie was added to "watched" ********** | ||
| # ******************************************************************************************* | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_does_nothing_if_movie_not_in_watchlist(): | ||
| # Arrange | ||
| # The variable movie_to_watch is assigned to HORROR_1 | ||
| movie_to_watch = HORROR_1 | ||
| # the dictionary about janes_data that has two keys | ||
| # "watchlist" and "watched" | ||
| janes_data = { | ||
| "watchlist": [FANTASY_1], | ||
| "watched": [FANTASY_2] | ||
| } | ||
|
|
||
| # Act | ||
| # name of the person janes_data and the name of the movie "Non-Existent Movie Title") | ||
| updated_data = watch_movie(janes_data, "Non-Existent Movie Title") | ||
|
|
||
| # Assert | ||
| assert len(updated_data["watchlist"]) == 1 | ||
| assert len(updated_data["watched"]) == 1 | ||
|
|
||
| # Is this checking for none of the varaibles are iny the updated dictionary | ||
| # checks if movie_to_watch variable is not in updated_data["watchlist"] | ||
| assert movie_to_watch not in updated_data["watchlist"] | ||
| # checks if movie_to_watch variable is not in updated_data["watched"] | ||
| assert movie_to_watch not in updated_data["watched"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| from viewing_party.party import * | ||
| from tests.test_constants import * | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_my_unique_movies(): | ||
| # Arrange | ||
| amandas_data = clean_wave_3_data() | ||
|
|
@@ -16,7 +16,7 @@ def test_my_unique_movies(): | |
| assert INTRIGUE_2 in amandas_unique_movies | ||
| assert amandas_data == clean_wave_3_data() | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_my_not_unique_movies(): | ||
| # Arrange | ||
| amandas_data = clean_wave_3_data() | ||
|
|
@@ -28,7 +28,7 @@ def test_my_not_unique_movies(): | |
| # Assert | ||
| assert len(amandas_unique_movies) == 0 | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_friends_unique_movies(): | ||
| # Arrange | ||
| amandas_data = clean_wave_3_data() | ||
|
|
@@ -43,24 +43,24 @@ def test_friends_unique_movies(): | |
| assert FANTASY_4 in friends_unique_movies | ||
| assert amandas_data == clean_wave_3_data() | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_friends_unique_movies_not_duplicated(): | ||
| # Arrange | ||
| amandas_data = clean_wave_3_data() | ||
| # amandas_data in dictionary "friends" in first friend added a movie to watched list | ||
| amandas_data["friends"][0]["watched"].append(INTRIGUE_3) | ||
|
|
||
| # Act | ||
| friends_unique_movies = get_friends_unique_watched(amandas_data) | ||
|
|
||
| # Assert | ||
| assert len(friends_unique_movies) == 3 | ||
| assert INTRIGUE_3 in friends_unique_movies | ||
| assert HORROR_1 in friends_unique_movies | ||
| assert FANTASY_4 in friends_unique_movies | ||
|
Comment on lines
+58
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wonderful! 💯 |
||
|
|
||
| raise Exception("Test needs to be completed.") | ||
| # ************************************************************************************************* | ||
| # ****** Add assertions here to test that the correct movies are in friends_unique_movies ********** | ||
| # ************************************************************************************************** | ||
|
|
||
| @pytest.mark.skip() | ||
| # @pytest.mark.skip() | ||
| def test_friends_not_unique_movies(): | ||
| # Arrange | ||
| amandas_data = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,144 @@ | ||
| # ------------- WAVE 1 -------------------- | ||
|
|
||
| from distutils.file_util import move_file | ||
| from pickle import FALSE | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remember to clear any import statements that we don't need before submission! 😉 |
||
|
|
||
|
|
||
| def create_movie(title, genre, rating): | ||
| pass | ||
| new_movie = {} | ||
| if title == None or genre == None or rating == None: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great chained logic in this conditional! |
||
| return None | ||
| else: | ||
| new_movie["title"] = title | ||
| new_movie["genre"] = genre | ||
| new_movie["rating"] = rating | ||
|
|
||
| return new_movie | ||
|
|
||
| def add_to_watched(user_data, movie): | ||
| user_data["watched"].append(movie) | ||
| return user_data | ||
|
|
||
| def add_to_watchlist(user_data, movie): | ||
| user_data["watchlist"].append(movie) | ||
| return user_data | ||
|
|
||
| def watch_movie(user_data, title): | ||
|
|
||
| if user_data["watchlist"] == None: | ||
| return user_data | ||
| else: | ||
| movie_to_move = None | ||
| # dict_movie name of each dictionary in "watchlist" | ||
| for dict_movie in user_data["watchlist"]: | ||
| # if the tittle in that dictionary evaluate to the same then do the following | ||
| if title == dict_movie["title"]: | ||
| # create a new varaible it becomes none when user_data["watchlist"] is removed | ||
| movie_to_move = dict_movie | ||
| # need to add this to a diffrent dictionary | ||
| # error here because condition needs to be true | ||
| if movie_to_move: | ||
| user_data["watched"].append(movie_to_move) | ||
| user_data["watchlist"].remove(movie_to_move) | ||
|
Comment on lines
+31
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great job working through this bit of logic and manipulating |
||
| return user_data | ||
|
|
||
| # ----------------------------------------- | ||
| # ------------- WAVE 2 -------------------- | ||
| # ----------------------------------------- | ||
|
|
||
| def get_watched_avg_rating(user_data): | ||
|
|
||
| all_ratings_added = 0 | ||
| if user_data["watched"] == []: | ||
| return 0 | ||
| for movie in user_data["watched"]: | ||
| rating = 0 | ||
| rating = movie["rating"] | ||
| all_ratings_added += rating | ||
|
Comment on lines
+55
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be shortened to |
||
|
|
||
| average_rating = all_ratings_added/len(user_data["watched"]) | ||
| return average_rating | ||
|
Comment on lines
+59
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great job combining division with the length calculation! |
||
|
|
||
| def get_most_watched_genre(user_data): | ||
| genres_map = {} | ||
| for movie in user_data["watched"]: | ||
| if movie["genre"] not in genres_map: | ||
| genres_map[movie["genre"]] = 1 | ||
| else: | ||
| genres_map[movie["genre"]] += 1 | ||
|
|
||
| maximum_key = None | ||
| maximum_value = 0 | ||
|
Comment on lines
+70
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, could we have more descriptive variable names? Maybe |
||
| for genre, quanity in genres_map.items(): | ||
| if quanity > maximum_value: | ||
| maximum_value = quanity | ||
| maximum_key = genre | ||
| return maximum_key | ||
|
|
||
|
|
||
| # ----------------------------------------- | ||
| # ------------- WAVE 3 -------------------- | ||
| # ----------------------------------------- | ||
|
|
||
|
|
||
| def get_unique_watched(user_data): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small nit/preference: I like to initialize all my known variables right after defining the function so I can keep track of them easier! For example, I (personally, meaning you don't have to do this!) would put L88 and L93 right after each other around L88. |
||
| # # compare movies of friends with user | ||
| # # create a list of dictionaries of the movies that have not been seen by the friends | ||
| # # return the list of dictionaries that friends have not watched | ||
|
|
||
| friends_movies = [] | ||
| for friend in user_data["friends"]: | ||
| for movie in friend["watched"]: | ||
| friends_movies.append(movie["title"]) | ||
|
|
||
| movie_list = [] | ||
| for movie in user_data["watched"]: | ||
| if movie["title"] not in friends_movies: | ||
| movie_list.append(movie) | ||
|
|
||
| return movie_list | ||
|
|
||
| def get_friends_unique_watched(user_data): | ||
| movie_list = [] | ||
| for movie in user_data["watched"]: | ||
| movie_list.append(movie["title"]) | ||
|
Comment on lines
+101
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can get rid of this and refer to |
||
|
|
||
| friends_movies = [] | ||
| for friend in user_data["friends"]: | ||
| for movie in friend["watched"]: | ||
| if movie["title"] not in movie_list: | ||
| if movie not in friends_movies: | ||
| friends_movies.append(movie) | ||
| return friends_movies | ||
| # ----------------------------------------- | ||
| # ------------- WAVE 4 -------------------- | ||
| # ----------------------------------------- | ||
|
|
||
| def get_available_recs(user_data): | ||
| # user has access to | ||
| # iterate over subscriptions access a string | ||
| movie_list = [] | ||
| for movie in user_data["watched"]: | ||
| movie_list.append(movie["title"]) | ||
|
|
||
| for subscription in user_data["subscriptions"]: | ||
| pass | ||
| # each friend has watched list | ||
|
|
||
| friends_movies = [] | ||
| for friend in user_data["friends"]: | ||
| for movie in friend["watched"]: | ||
| for host in movie["host"]: | ||
| if movie["title"] not in movie_list: | ||
| if movie not in friends_movies: | ||
| if host in movie_list: | ||
| friends_movies.append(movie) | ||
|
|
||
|
Comment on lines
+128
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👀 OOOO, interested in where you might be going here! Let me know if you want to walk through this Wave in our 1:1s! |
||
|
|
||
| # ----------------------------------------- | ||
| # ------------- WAVE 5 -------------------- | ||
| # ----------------------------------------- | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful assertion statements! ✨