mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	Correct test suite for #848017.
This commit is contained in:
		
							parent
							
								
									3fa5575fa4
								
							
						
					
					
						commit
						8246c439a8
					
				
					 2 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
					@ -224,6 +224,7 @@ __all__ = ["CookieError","BaseCookie","SimpleCookie","SerialCookie",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_nulljoin = ''.join
 | 
					_nulljoin = ''.join
 | 
				
			||||||
_semispacejoin = '; '.join
 | 
					_semispacejoin = '; '.join
 | 
				
			||||||
 | 
					_spacejoin = ' '.join
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Define an exception visible to External modules
 | 
					# Define an exception visible to External modules
 | 
				
			||||||
| 
						 | 
					@ -594,7 +595,7 @@ class BaseCookie(dict):
 | 
				
			||||||
        items.sort()
 | 
					        items.sort()
 | 
				
			||||||
        for K,V in items:
 | 
					        for K,V in items:
 | 
				
			||||||
            L.append( '%s=%s' % (K,repr(V.value) ) )
 | 
					            L.append( '%s=%s' % (K,repr(V.value) ) )
 | 
				
			||||||
        return '<%s: %s>' % (self.__class__.__name__, _semispacejoin(L))
 | 
					        return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def js_output(self, attrs=None):
 | 
					    def js_output(self, attrs=None):
 | 
				
			||||||
        """Return a string suitable for JavaScript."""
 | 
					        """Return a string suitable for JavaScript."""
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,17 +12,17 @@ warnings.filterwarnings("ignore",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cases = [
 | 
					cases = [
 | 
				
			||||||
    ('chips=ahoy; vienna=finger', {'chips':'ahoy', 'vienna':'finger'}),
 | 
					    ('chips=ahoy; vienna=finger', {'chips':'ahoy', 'vienna':'finger'}),
 | 
				
			||||||
    ('keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;";',
 | 
					    ('keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"',
 | 
				
			||||||
     {'keebler' : 'E=mc2; L="Loves"; fudge=\012;'}),
 | 
					     {'keebler' : 'E=mc2; L="Loves"; fudge=\012;'}),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Check illegal cookies that have an '=' char in an unquoted value
 | 
					    # Check illegal cookies that have an '=' char in an unquoted value
 | 
				
			||||||
    ('keebler=E=mc2;', {'keebler' : 'E=mc2'})
 | 
					    ('keebler=E=mc2', {'keebler' : 'E=mc2'})
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for data, dict in cases:
 | 
					for data, dict in cases:
 | 
				
			||||||
    C = Cookie.SimpleCookie() ; C.load(data)
 | 
					    C = Cookie.SimpleCookie() ; C.load(data)
 | 
				
			||||||
    print repr(C)
 | 
					    print repr(C)
 | 
				
			||||||
    print str(C)
 | 
					    print C.output(sep='\n')
 | 
				
			||||||
    for k, v in sorted(dict.iteritems()):
 | 
					    for k, v in sorted(dict.iteritems()):
 | 
				
			||||||
        print ' ', k, repr( C[k].value ), repr(v)
 | 
					        print ' ', k, repr( C[k].value ), repr(v)
 | 
				
			||||||
        verify(C[k].value == v)
 | 
					        verify(C[k].value == v)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue