From 7bb12e72df9d219d7438c24eed5ac860e2b4ba96 Mon Sep 17 00:00:00 2001 From: Muhammad Abdullah Date: Sat, 28 Oct 2023 18:42:31 +0500 Subject: [PATCH] Fix test cases --- tests/test_gnews.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_gnews.py b/tests/test_gnews.py index d8fca5c..7c788b6 100644 --- a/tests/test_gnews.py +++ b/tests/test_gnews.py @@ -33,13 +33,19 @@ def test_get_news_by_location(self): self.assertTrue(isinstance(news_articles, list)) self.assertTrue(len(news_articles) > 0) - def test_get_news_by_site(self): - # Test that get_news_by_site returns a non-empty list of news articles for a valid site + def test_get_news_by_site_valid(self): + # Test that get_news_by_site returns news articles for a valid site domain site = "cnn.com" - news_articles - self.gnews.get_news_by_site(site) + news_articles = self.gnews.get_news_by_site(site) self.assertTrue(isinstance(news_articles, list)) self.assertTrue(len(news_articles) > 0) + def test_get_news_by_site_invalid(self): + # Test that get_news_by_site returns an empty list for an invalid site domain + site = "invalidsite123.com" + news_articles = self.gnews.get_news_by_site(site) + self.assertEqual(news_articles, []) + def test_get_full_article(self): pass # Test that get_full_article returns a valid article object for a valid URL