Skip to content

Ruby - Jasmine S. and Thea V #51

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

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3e0582b
Add Pair Programming Contract to README
bunnaery Mar 27, 2023
8ff1619
pass test_1 wave_1
chickenoregg Mar 27, 2023
86a1da5
Finished create_movie, started add_to_watched
bunnaery Mar 28, 2023
23562bb
add to_watch_list function
chickenoregg Mar 28, 2023
0f3e06b
Add watch_movie function and passed 9 out of 11 tests
bunnaery Mar 28, 2023
8087a8a
pass wave 01
chickenoregg Mar 28, 2023
f5a81a1
pass 1 of wave_02
chickenoregg Mar 28, 2023
5e303ba
Add get_most_watched_genre and passed wave 02 tests
bunnaery Mar 28, 2023
d9a5a95
pass 2 tests in wave_03
chickenoregg Mar 28, 2023
6c50cdd
Add get_friends_unique_watched function and passed wave 03
bunnaery Mar 28, 2023
8f42f37
Removed some excess spacing and comment on test in wave 03
bunnaery Mar 28, 2023
f3815f4
fix comments
chickenoregg Mar 29, 2023
2a0e96f
Refactor get_friends_unique_watched to simplify logic
bunnaery Mar 29, 2023
f3ed04a
Refactor get_most_watched_genre to remove unnecessary guard conditional
bunnaery Mar 29, 2023
3c21c2c
Refactor watch_movie function to improve readability
bunnaery Mar 29, 2023
a7facf9
Refactor get_most_watched_genre to use max function
bunnaery Mar 30, 2023
7461654
Create get_available_recs function and pass wave 4
bunnaery Mar 30, 2023
8a3980a
Add get_new_rec_by_genre function
bunnaery Mar 30, 2023
c8dc2b7
Add get_rec_from_favorites function
bunnaery Mar 30, 2023
983aa6c
pass test wave 5
chickenoregg Mar 30, 2023
1618bb1
refactor wave 03 first function and import copy
chickenoregg Mar 30, 2023
819fd0c
Standardize spacing between functions; remove blank lines at end of f…
bunnaery Mar 30, 2023
496380c
Update / add comments and docstring to functions
bunnaery Mar 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Viewing Party

## Pair Programming "Contract"
- cowork virtually 1-3pm
- general 8pm hard stop every day
- zoom call + screenshare / vs live share
- take time so that both folks understand what the code is doing
- be in communication either live or comments or chat about what's being updated / changed
- leave room to let driver "finish thought" before chatting / circling back / fixing errors
- don't work ahead more than one test solo
- tentative refactor schedule: check-in after wave_01 tests all pass

## Skills Assessed

Solving problems with...
Expand Down
55 changes: 33 additions & 22 deletions tests/test_wave_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,7 +19,8 @@ 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
Expand All @@ -32,7 +33,8 @@ 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"
Expand All @@ -45,7 +47,8 @@ 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"
Expand All @@ -58,7 +61,8 @@ 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 = {
Expand All @@ -79,7 +83,8 @@ 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_non_empty_user_watched():
# Arrange
movie = {
Expand All @@ -99,7 +104,8 @@ def test_adds_movie_to_non_empty_user_watched():
assert movie in updated_data["watched"]
assert FANTASY_2 in updated_data["watched"]

@pytest.mark.skip()

# @pytest.mark.skip()
def test_adds_movie_to_user_watchlist():
# Arrange
movie = {
Expand All @@ -120,7 +126,8 @@ 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_adds_movie_to_non_empty_user_watchlist():
# Arrange
movie = {
Expand All @@ -140,7 +147,8 @@ def test_adds_movie_to_non_empty_user_watchlist():
assert movie in updated_data["watchlist"]
assert FANTASY_2 in updated_data["watchlist"]

@pytest.mark.skip()

# @pytest.mark.skip()
def test_moves_movie_from_watchlist_to_empty_watched():
# Arrange
janes_data = {
Expand All @@ -158,13 +166,19 @@ def test_moves_movie_from_watchlist_to_empty_watched():
# Assert
assert len(updated_data["watchlist"]) == 0
assert len(updated_data["watched"]) == 1

raise Exception("Test needs to be completed.")
# *******************************************************************************************
# ****** Add assertions here to test that the correct movie was added to "watched" **********
# *******************************************************************************************
assert updated_data["watched"][0] == {
"title": MOVIE_TITLE_1,
"genre": GENRE_1,
"rating": RATING_1
}
Comment on lines +169 to +173

Choose a reason for hiding this comment

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

This assert does the same thing as the three below. There's no need to check each individual key if you've already checked all of them!


@pytest.mark.skip()
# Assert that the correct movie was added to watched
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


# @pytest.mark.skip()
def test_moves_movie_from_watchlist_to_watched():
# Arrange
movie_to_watch = HORROR_1
Expand All @@ -182,13 +196,10 @@ def test_moves_movie_from_watchlist_to_watched():
# Assert
assert len(updated_data["watchlist"]) == 1
assert len(updated_data["watched"]) == 2

raise Exception("Test needs to be completed.")
# *******************************************************************************************
# ****** Add assertions here to test that the correct movie was added to "watched" **********
# *******************************************************************************************
assert updated_data["watched"][1] == movie_to_watch

Choose a reason for hiding this comment

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

Excellent!



@pytest.mark.skip()
# @pytest.mark.skip()
def test_does_nothing_if_movie_not_in_watchlist():
# Arrange
movie_to_watch = HORROR_1
Expand All @@ -204,4 +215,4 @@ def test_does_nothing_if_movie_not_in_watchlist():
assert len(updated_data["watchlist"]) == 1
assert len(updated_data["watched"]) == 1
assert movie_to_watch not in updated_data["watchlist"]
assert movie_to_watch not in updated_data["watched"]
assert movie_to_watch not in updated_data["watched"]
17 changes: 11 additions & 6 deletions tests/test_wave_02.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from viewing_party.party import *
from tests.test_constants import *

@pytest.mark.skip()

# @pytest.mark.skip()
def test_calculates_watched_average_rating():
# Arrange
janes_data = clean_wave_2_data()
Expand All @@ -14,7 +15,8 @@ def test_calculates_watched_average_rating():
assert average == pytest.approx(3.58333)
assert janes_data == clean_wave_2_data()

@pytest.mark.skip()

# @pytest.mark.skip()
def test_empty_watched_average_rating_is_zero():
# Arrange
janes_data = {
Expand All @@ -27,7 +29,8 @@ def test_empty_watched_average_rating_is_zero():
# Assert
assert average == pytest.approx(0.0)

@pytest.mark.skip()

# @pytest.mark.skip()
def test_most_watched_genre():
# Arrange
janes_data = clean_wave_2_data()
Expand All @@ -39,7 +42,8 @@ def test_most_watched_genre():
assert popular_genre == "Fantasy"
assert janes_data == clean_wave_2_data()

@pytest.mark.skip()

# @pytest.mark.skip()
def test_most_watched_genre_order_mixed():
# Arrange
janes_data = clean_wave_2b_data()
Expand All @@ -51,7 +55,8 @@ def test_most_watched_genre_order_mixed():
assert popular_genre == "Fantasy"
assert janes_data == clean_wave_2b_data()

@pytest.mark.skip()

# @pytest.mark.skip()
def test_genre_is_None_if_empty_watched():
# Arrange
janes_data = {
Expand All @@ -62,4 +67,4 @@ def test_genre_is_None_if_empty_watched():
popular_genre = get_most_watched_genre(janes_data)

# Assert
assert popular_genre == None
assert popular_genre == None
21 changes: 11 additions & 10 deletions tests/test_wave_03.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
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()
Expand All @@ -16,7 +17,8 @@ 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()
Expand All @@ -28,7 +30,8 @@ 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()
Expand All @@ -43,7 +46,8 @@ 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()
Expand All @@ -54,13 +58,10 @@ def test_friends_unique_movies_not_duplicated():

# Assert
assert len(friends_unique_movies) == 3
assert friends_unique_movies == [FANTASY_4, HORROR_1, INTRIGUE_3]

Choose a reason for hiding this comment

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

Be careful using == for asserts on lists. If, for some reason, the movies end up in a different order, this test would fail even if all of the elements are the same. == requires that the ordering of the elements be the same as well. Instead, consider statements like assert FANTASY_4 in friends_unique_movies. That way it doesn't matter what order the list is in, as long as those movies are in the list somewhere.


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 = {
Expand All @@ -86,4 +87,4 @@ def test_friends_not_unique_movies():
friends_unique_movies = get_friends_unique_watched(amandas_data)

# Assert
assert len(friends_unique_movies) == 0
assert len(friends_unique_movies) == 0

Choose a reason for hiding this comment

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

Excellent!

11 changes: 7 additions & 4 deletions tests/test_wave_04.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from viewing_party.party import *
from tests.test_constants import *

@pytest.mark.skip()

# @pytest.mark.skip()
def test_get_available_friend_rec():
# Arrange
amandas_data = clean_wave_4_data()
Expand All @@ -16,7 +17,8 @@ def test_get_available_friend_rec():
assert FANTASY_4b in recommendations
assert amandas_data == clean_wave_4_data()

@pytest.mark.skip()

# @pytest.mark.skip()
def test_no_available_friend_recs():
# Arrange
amandas_data = {
Expand All @@ -38,7 +40,8 @@ def test_no_available_friend_recs():
# Assert
assert len(recommendations) == 0

@pytest.mark.skip()

# @pytest.mark.skip()
def test_no_available_friend_recs_watched_all():
# Arrange
amandas_data = {
Expand All @@ -58,4 +61,4 @@ def test_no_available_friend_recs_watched_all():
recommendations = get_available_recs(amandas_data)

# Arrange
assert len(recommendations) == 0
assert len(recommendations) == 0
Loading