Skip to content

Ocelots - Megan Maple#2

Open
maple-megan333 wants to merge 5 commits intoada-ac2:masterfrom
maple-megan333:master
Open

Ocelots - Megan Maple#2
maple-megan333 wants to merge 5 commits intoada-ac2:masterfrom
maple-megan333:master

Conversation

@maple-megan333
Copy link
Copy Markdown

No description provided.

Comment thread tests/test_wave_01.py
# *******************************************************************************************
# ****** Add assertions here to test that the correct movie was added to "watched" **********
# *******************************************************************************************
assert updated_data["watched"][0]["title"] == MOVIE_TITLE_1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job testing all of the attributes here :)

Comment thread tests/test_wave_03.py
# *************************************************************************************************
# ****** Add assertions here to test that the correct movies are in friends_unique_movies **********
# **************************************************************************************************
assert INTRIGUE_3 in friends_unique_movies
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job testing the specific content here

Comment thread viewing_party/party.py
def create_movie(title, genre, rating):
pass
print("***************************")
new_movie = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was room for input validation here :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-- before the data structure was created and tested, below :)

Comment thread viewing_party/party.py
return user_data

def watch_movie(user_data, movie_title):
for movie in user_data["watchlist"]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, while this may work here, it's considered dangerous practice to modify the content of a data structure that you're looping over. Especially in more complex code, this can open you up to complex errors. A simple alternative here could be to save a copy of what you get from movie in user_data["watchlist"] and iterate over that, so that as you modify user_data["watchlist"], there's no risk.

Comment thread viewing_party/party.py
movie_genres[movie['genre']] += 1
else:
movie_genres[movie['genre']] = 1
return max(movie_genres, key=movie_genres.get)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of max() with a custom key function to sort a dict!

Comment thread viewing_party/party.py

def get_most_watched_genre(user_data):
if user_data["watched"]:
movie_genres = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of a dict in your data processing

Comment thread viewing_party/party.py
# ------------- WAVE 3 --------------------
# -----------------------------------------

def get_unique_watched(user_data):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could sets have been useful alternatives to the nested loops in these functions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants