@@ -59,6 +59,39 @@ def test_basic(self):
5959 for k , v in sorted (case ['dict' ].items ()):
6060 self .assertEqual (C [k ].value , v )
6161
62+ def test_obsolete_rfc850_date_format (self ):
63+ # Test cases with different days and dates in obsolete RFC 850 format
64+ test_cases = [
65+ {
66+ 'data' : 'key=value; expires=Sunday, 06-Nov-94 08:49:37 GMT' ,
67+ 'output' : 'Sunday, 06-Nov-94 08:49:37 GMT'
68+ },
69+ {
70+ 'data' : 'key=value; expires=Wednesday, 09-Nov-94 08:49:37 GMT' ,
71+ 'output' : 'Wednesday, 09-Nov-94 08:49:37 GMT'
72+ },
73+ {
74+ 'data' : 'key=value; expires=Friday, 11-Nov-94 08:49:37 GMT' ,
75+ 'output' : 'Friday, 11-Nov-94 08:49:37 GMT'
76+ },
77+ {
78+ 'data' : 'key=value; expires=Monday, 14-Nov-94 08:49:37 GMT' ,
79+ 'output' : 'Monday, 14-Nov-94 08:49:37 GMT'
80+ },
81+ ]
82+
83+ for case in test_cases :
84+ with self .subTest (data = case ['data' ]):
85+ C = cookies .SimpleCookie ()
86+ C .load (case ['data' ])
87+
88+ # Extract the cookie name from the data string
89+ cookie_name = case ['data' ].split ('=' )[0 ]
90+
91+ # Check if the cookie is loaded correctly
92+ self .assertIn (cookie_name , C )
93+ self .assertEqual (C [cookie_name ].get ('expires' ), case ['output' ])
94+
6295 def test_unquote (self ):
6396 cases = [
6497 (r'a="b=\""' , 'b="' ),
0 commit comments