From 37be7a5525df0a32bed61a17a5262509d9ef9f5b Mon Sep 17 00:00:00 2001 From: hoelee Date: Wed, 14 Oct 2026 18:44:00 +0800 Subject: [PATCH] feat(py-monitor): add UrlTests() --- platform/py-monitor/tests/test_core.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 platform/py-monitor/tests/test_core.py diff --git a/platform/py-monitor/tests/test_core.py b/platform/py-monitor/tests/test_core.py new file mode 100644 index 00000000..1dffd1bc --- /dev/null +++ b/platform/py-monitor/tests/test_core.py @@ -0,0 +1,20 @@ +"""Unit tests for the extracted primitives (stdlib unittest, no deps).""" +import os +import sys +import unittest + +sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) + +from monitor_core import (normalize_product_url, normalize_condition, parse_price, + strip_thumbnail_suffix, title_matches_keyword, iso_from_epoch, iso_now) + + +class UrlTests(unittest.TestCase): + + def test_strips_progressive_thumbnail(self): + url = "https://media.example.com/abc.jpg_progressive_thumbnail" + self.assertEqual("https://media.example.com/abc.jpg", strip_thumbnail_suffix(url)) + + +if __name__ == "__main__": + unittest.main()