From bc51c5c5b0dd252c0102a2966238db3872c0763d Mon Sep 17 00:00:00 2001
From: rishi2019194 <58341663+rishi2019194@users.noreply.github.com>
Date: Tue, 17 Oct 2023 13:25:38 -0400
Subject: [PATCH 1/5] Update test_util.py
---
test/test_util.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_util.py b/test/test_util.py
index 32e8ceac4..4ebf80484 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -6,7 +6,7 @@
import unittest
import warnings
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
#pylint: enable=wrong-import-position
From 73c4b2c1d6d8f603f22916aab4d90e38310431eb Mon Sep 17 00:00:00 2001
From: rishi2019194 <58341663+rishi2019194@users.noreply.github.com>
Date: Tue, 17 Oct 2023 13:28:34 -0400
Subject: [PATCH 2/5] Update test_util.py
---
test/test_util.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_util.py b/test/test_util.py
index 4ebf80484..42c187847 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -5,8 +5,8 @@
import sys
import unittest
import warnings
-import pandas as pd
sys.path.append(str(Path(__file__).resolve().parents[1]))
+import pandas as pd
#pylint: disable=wrong-import-position
from src.recommenderapp.utils import create_colored_tags, beautify_feedback_data, create_movie_genres, send_email_to_user
#pylint: enable=wrong-import-position
From c6e2d86c478ba1e807e84d349d6ae8dff5f6ceb3 Mon Sep 17 00:00:00 2001
From: rishi2019194 <58341663+rishi2019194@users.noreply.github.com>
Date: Tue, 17 Oct 2023 13:29:15 -0400
Subject: [PATCH 3/5] Update unittest.yml
---
.github/workflows/unittest.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml
index 920e7400d..f475e448a 100644
--- a/.github/workflows/unittest.yml
+++ b/.github/workflows/unittest.yml
@@ -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
From a411a44628ea9bdbe450b136633ed2862ae681b2 Mon Sep 17 00:00:00 2001
From: rishi2019194 <58341663+rishi2019194@users.noreply.github.com>
Date: Tue, 17 Oct 2023 13:33:51 -0400
Subject: [PATCH 4/5] Update test_util.py
refactor the code
---
test/test_util.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/test/test_util.py b/test/test_util.py
index 42c187847..992b90894 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -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")
@@ -35,7 +37,8 @@ def test_create_colored_tags(self):
"""
Test case 2
"""
- expected_result = 'Musical'
+ expected_result = 'Musical'
result = create_colored_tags(['Musical'])
self.assertTrue(result == expected_result)
@@ -43,7 +46,8 @@ 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)
From a71ebace251421303a6c4278a37b77775c6d1502 Mon Sep 17 00:00:00 2001
From: adipai
Date: Tue, 17 Oct 2023 14:24:11 -0400
Subject: [PATCH 5/5] Fixed bug in test suite
---
test/test_util.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/test/test_util.py b/test/test_util.py
index 992b90894..5c4186533 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -37,8 +37,8 @@ def test_create_colored_tags(self):
"""
Test case 2
"""
- expected_result = 'Musical'
+ expected_result = 'Musical'
result = create_colored_tags(['Musical'])
self.assertTrue(result == expected_result)
@@ -49,7 +49,15 @@ def test_create_movie_genres(self):
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)