diff options
| author | 2024-10-14 03:02:11 -0400 | |
|---|---|---|
| committer | 2024-10-14 03:02:11 -0400 | |
| commit | b28a9957b772b1d063bea4a50c0bbcb04cdef791 (patch) | |
| tree | bdf3b3bafb821af5cd41206d66c4a0b7a60e2a92 /test/test_text.py | |
| parent | 061cbaf29e92e57152175f877740d3d1a2157bd6 (diff) | |
| parent | 0db541f524e1774865efebcbe5653e9ad76ea2e8 (diff) | |
Update upstream source from tag 'upstream/1.27.6'
Update to upstream version '1.27.6'
with Debian dir bbafbef8a09f7a005c8afa3ebb1c8527d67c172a
Diffstat (limited to 'test/test_text.py')
| -rw-r--r-- | test/test_text.py | 22 |
1 files changed, 22 insertions, 0 deletions
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) |
