feat(py-monitor): add UrlTests()

This commit is contained in:
hoelee committed 2026-10-14 18:44:00 +08:00
1 parent 5b81b953b4
commit 37be7a5525
1 file changed
+20
+20
View File
@@ -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()