File support-python-311.patch of Package python-mechanize

Index: mechanize-0.4.8/test/test_cookies.py
===================================================================
--- mechanize-0.4.8.orig/test/test_cookies.py
+++ mechanize-0.4.8/test/test_cookies.py
@@ -1015,13 +1015,23 @@ class CookieTests(unittest.TestCase):
             r'port="90,100, 80,8080"; '
             r'max-age=100; Comment = "Just kidding! (\"|\\\\) "')
 
-        versions = [1, 1, 1, 0, 1]
-        names = ["bang", "foo", "foo", "spam", "foo"]
-        domains = [
-            ".sol.no", "blah.spam.org", "www.acme.com", "www.acme.com",
-            "www.acme.com"
-        ]
-        paths = ["/", "/", "/", "/blah", "/blah/"]
+        # Python 3.11+ no longer sort cookies when returning them.
+        if sys.version_info >= (3, 11):
+            versions = [1, 0, 1, 1, 1]
+            names = ["foo", "spam", "foo", "foo", "bang"]
+            domains = [
+                "blah.spam.org", "www.acme.com", "www.acme.com",
+                 "www.acme.com", ".sol.no"
+            ]
+            paths = ["/", "/blah", "/blah/", "/", "/"]
+        else:
+            versions = [1, 1, 1, 0, 1]
+            names = ["bang", "foo", "foo", "spam", "foo"]
+            domains = [
+                ".sol.no", "blah.spam.org", "www.acme.com", "www.acme.com",
+                "www.acme.com"
+            ]
+            paths = ["/", "/", "/", "/blah", "/blah/"]
 
         # sequential iteration
         for i in range(4):
openSUSE Build Service is sponsored by