feat(py-monitor): add test_core.py()

This commit is contained in:
hoelee committed 2026-10-15 11:12:00 +08:00
1 parent 6db4aa015a
commit d744be9054
1 file changed
+13
+13
View File
@@ -19,6 +19,19 @@ class UrlTests(unittest.TestCase):
url = "https://media.example.com/abc.jpg"
self.assertEqual(url, strip_thumbnail_suffix(url))
def test_strip_keeps_empty_input(self):
self.assertEqual("", strip_thumbnail_suffix(""))
def test_normalize_drops_query_and_fragment(self):
a = "https://www.carousell.com.my/p/1234/?utm_source=x#top"
b = "https://WWW.Carousell.com.my/p/1234/"
self.assertEqual(normalize_product_url(a), normalize_product_url(b))
self.assertEqual("https://www.carousell.com.my/p/1234", normalize_product_url(a))
def test_normalize_handles_empty(self):
self.assertEqual("", normalize_product_url(None))
if __name__ == "__main__":
unittest.main()