From 0db541f524e1774865efebcbe5653e9ad76ea2e8 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Mon, 14 Oct 2024 03:02:05 -0400 Subject: New upstream version 1.27.6. --- test/test_text.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/test_text.py') diff --git a/test/test_text.py b/test/test_text.py index 084436b..1b19c47 100644 --- a/test/test_text.py +++ b/test/test_text.py @@ -413,6 +413,28 @@ class TestText(unittest.TestCase): for value in INVALID: self.assertEqual(f(value), {}) + def test_parse_query_list(self, f=text.parse_query_list): + # standard usage + self.assertEqual(f(""), {}) + self.assertEqual(f("foo=1"), {"foo": "1"}) + self.assertEqual(f("foo=1&bar=2"), {"foo": "1", "bar": "2"}) + + # missing value + self.assertEqual(f("bar"), {}) + self.assertEqual(f("foo=1&bar"), {"foo": "1"}) + self.assertEqual(f("foo=1&bar&baz=3"), {"foo": "1", "baz": "3"}) + + # keys with identical names + self.assertEqual(f("foo=1&foo=2"), {"foo": ["1", "2"]}) + self.assertEqual( + f("foo=1&bar=2&foo=3&bar=4&foo=5"), + {"foo": ["1", "3", "5"], "bar": ["2", "4"]}, + ) + + # invalid arguments + for value in INVALID: + self.assertEqual(f(value), {}) + def test_parse_timestamp(self, f=text.parse_timestamp): null = util.datetime_utcfromtimestamp(0) value = util.datetime_utcfromtimestamp(1555816235) -- cgit v1.2.3