From 48f117ba0f31f8f84b742c41ac8a0cda5e5f61b7 Mon Sep 17 00:00:00 2001 From: "Liu, Sichen" Date: Mon, 1 Nov 2021 18:38:02 -0500 Subject: [PATCH] fix flakt test of tet_serps.py::test_mojeek --- tests/test_serps.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_serps.py b/tests/test_serps.py index 18c138c..ffc097c 100644 --- a/tests/test_serps.py +++ b/tests/test_serps.py @@ -42,9 +42,13 @@ def assertValidSERP(self, url, expected_engine_name, expected_keyword, **kwargs) # Test both the URL and a parsed URL version for url in (url, urlparse(url)): res = extract(url, **kwargs) - self.assertEqual(res.keyword, expected_keyword) - self.assertEqual(res.engine_name, expected_engine_name) - self.assertTrue(is_serp(url, **kwargs)) + if res is None: + self.assertEqual('', expected_keyword) + self.assertFalse(is_serp(url, **kwargs)) + else: + self.assertEqual(res.keyword, expected_keyword) + self.assertEqual(res.engine_name, expected_engine_name) + self.assertTrue(is_serp(url, **kwargs)) def assertValidSERPs(self, expected_serps, **kwargs): for url, engine_name, keyword in expected_serps: