-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ignacy Janiszewski
committed
Aug 27, 2020
1 parent
79d8751
commit e9c6d01
Showing
7 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
import argparse | ||
|
||
from main import GetInfo | ||
from src.main import GetInfo | ||
|
||
|
||
class GetArgument: | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pandas as pd | ||
|
||
from src.settings import comments_data, movies_data | ||
from src.main import IngestData | ||
|
||
|
||
|
||
def test_comments_concatenate(): | ||
com_id = IngestData(**comments_data) | ||
comments_df = com_id.get_df() | ||
assert comments_df.shape[0] > 1000 | ||
assert comments_df.shape[1] == 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import pandas as pd | ||
|
||
from src.main import GetInfo | ||
|
||
|
||
def create_comments_example_df(): | ||
data = { | ||
"id_comment": [no for no in range(6)], | ||
"user": [f"user{user_no}" for user_no in range(6)], | ||
"id_movie": [1 for no in range(3)] + [2 for no in range(3)] | ||
} | ||
df = pd.DataFrame(data, columns = data.keys()).set_index("id_comment") | ||
return df | ||
|
||
|
||
def create_movies_example_df(): | ||
data = { | ||
"id_movie": [no for no in range(6)], | ||
"title": [f"movie_{movie}" for movie in range(6)], | ||
"ig_game": [1 for no in range(3)] + [2 for no in range(3)] | ||
} | ||
df = pd.DataFrame(data, columns = data.keys()).set_index("id_movie") | ||
return df | ||
|
||
|
||
|
||
def test_get_movie_comments(): | ||
example_df = create_comments_example_df() | ||
gi = GetInfo() | ||
comments_no = gi.get_movie_comments(1, example_df) | ||
assert comments_no == 3 | ||
|
||
|
||
def test_get_movie_title(): | ||
example_df = create_movies_example_df() | ||
gi = GetInfo() | ||
movie_title = gi.get_movie_title(1, example_df) | ||
assert movie_title == "movie_1" | ||
|
||
|
||
def test_get_movie_title_no_movie_id(): | ||
example_df = create_movies_example_df() | ||
gi = GetInfo() | ||
movie_title = gi.get_movie_title('X', example_df) | ||
assert movie_title == None |