From 3016d1287c79335dd63513830968b478a8bb1520 Mon Sep 17 00:00:00 2001 From: shoko <270575765+shokollm@users.noreply.github.com> Date: Fri, 27 Mar 2026 01:14:45 +0000 Subject: [PATCH] test(polymarket-browse): add URL encoding unit tests Add TestUrlEncoding class testing quote() encodes: - Space -> %20 - & -> %26 - = -> %3D - % -> %25 - + -> %2B - ( -> %28 - ) -> %29 - # -> %23 --- skills/polymarket-browse/tests/test_browse.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/skills/polymarket-browse/tests/test_browse.py b/skills/polymarket-browse/tests/test_browse.py index 397c581..a103434 100644 --- a/skills/polymarket-browse/tests/test_browse.py +++ b/skills/polymarket-browse/tests/test_browse.py @@ -1839,5 +1839,25 @@ class TestBrowseEvents(unittest.TestCase): self.assertIn("partial", result) +class TestUrlEncoding(unittest.TestCase): + """Tests for proper URL encoding of search queries.""" + + def test_quote_encodes_special_chars(self): + """quote() should properly encode all special characters.""" + from urllib.parse import quote + + test_cases = [ + ("Team A", "Team%20A"), + ("Team A & Team B", "Team%20A%20%26%20Team%20B"), + ("a=b", "a%3Db"), + ("100%", "100%25"), + ("C++", "C%2B%2B"), + ("Team (A)", "Team%20%28A%29"), + ("Team#1", "Team%231"), + ] + for input_str, expected in test_cases: + self.assertEqual(quote(input_str, safe=""), expected) + + if __name__ == "__main__": unittest.main()