Skip to content

Commit

Permalink
Update test_util.py
Browse files Browse the repository at this point in the history
refactor the code
  • Loading branch information
rishi2019194 authored Oct 17, 2023
1 parent c6e2d86 commit a411a44
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 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
sys.path.append(str(Path(__file__).resolve().parents[1]))
from pathlib import Path
import pandas as pd
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,15 +37,17 @@ 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)
result = create_movie_genres(movie_genre_df)
Expand Down

0 comments on commit a411a44

Please sign in to comment.