Skip to content

Commit

Permalink
Merge pull request #49 from adipai/rishi2019194-patch-1
Browse files Browse the repository at this point in the history
Test suite configuration and setup for backend
  • Loading branch information
ananya173147 authored Oct 17, 2023
2 parents 940dcc2 + a71ebac commit 711cd8b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ jobs:
run: python test/tests.py
- name: Running test cases for searching
run: python test/test_search.py
- name: Running test cases for util
run: python test/test_util.py

22 changes: 17 additions & 5 deletions test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import sys
import unittest
import warnings
from pathlib import Path
import pandas as pd
sys.path.append("../")
sys.path.append(str(Path(__file__).resolve().parents[1]))
#pylint: disable=wrong-import-position
from src.recommenderapp.utils import create_colored_tags, beautify_feedback_data, create_movie_genres, send_email_to_user
from src.recommenderapp.utils import create_colored_tags, \
beautify_feedback_data, create_movie_genres, send_email_to_user
#pylint: enable=wrong-import-position

warnings.filterwarnings("ignore")
Expand All @@ -35,17 +37,27 @@ def test_create_colored_tags(self):
"""
Test case 2
"""
expected_result = '<span style="background-color: #FF1493; color: #FFFFFF; padding: 5px; border-radius: 5px;">Musical</span>'
expected_result = '<span style="background-color: #FF1493; color: #FFFFFF; \
padding: 5px; border-radius: 5px;">Musical</span>'
result = create_colored_tags(['Musical'])
self.assertTrue(result == expected_result)

def test_create_movie_genres(self):
"""
Test case 3
"""
expected_result = {'Toy Story (1995)': ['Animation', 'Comedy', 'Family'], 'Jumanji (1995)': [
expected_result = {'Toy Story (1995)': ['Animation', 'Comedy', 'Family'], \
'Jumanji (1995)': [
'Adventure', 'Fantasy', 'Family']}
movie_genre_df = pd.read_csv('../data/movies.csv').head(n=2)

data = [["862", "Toy Story (1995)", "Animation|Comedy|Family", \
"tt0114709", " ", "/rhIRbceoE9lR4veEXuwCC2wARtG.jpg", "81"], \
["8844", "Jumanji (1995)", "Adventure|Fantasy|Family", "tt0113497", " ", \
"/vzmL6fP7aPKNKPRTFnZmiUfciyV.jpg", "104"]]

movie_genre_df = pd.DataFrame(data, columns=[
'movieId', 'title', 'genres', 'imdb_id', 'overview', 'poster_path', 'runtime'])

result = create_movie_genres(movie_genre_df)
self.assertTrue(result == expected_result)

Expand Down

0 comments on commit 711cd8b

Please sign in to comment.