mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	Issue #19681: Test the repr of partial with more than one keyword argument.
This commit is contained in:
		
							parent
							
								
									fa310ee3a9
								
							
						
					
					
						commit
						0aa74e10bb
					
				
					 1 changed files with 9 additions and 7 deletions
				
			
		|  | @ -155,9 +155,9 @@ def test_attributes_unwritable(self): | |||
|     def test_repr(self): | ||||
|         args = (object(), object()) | ||||
|         args_repr = ', '.join(repr(a) for a in args) | ||||
|         #kwargs = {'a': object(), 'b': object()} | ||||
|         kwargs = {'a': object()} | ||||
|         kwargs_repr = ', '.join("%s=%r" % (k, v) for k, v in kwargs.items()) | ||||
|         kwargs = {'a': object(), 'b': object()} | ||||
|         kwargs_reprs = ['a={a!r}, b={b!r}'.format_map(kwargs), | ||||
|                         'b={b!r}, a={a!r}'.format_map(kwargs)] | ||||
|         if self.partial is c_functools.partial: | ||||
|             name = 'functools.partial' | ||||
|         else: | ||||
|  | @ -172,12 +172,14 @@ def test_repr(self): | |||
|                          repr(f)) | ||||
| 
 | ||||
|         f = self.partial(capture, **kwargs) | ||||
|         self.assertEqual('{}({!r}, {})'.format(name, capture, kwargs_repr), | ||||
|                          repr(f)) | ||||
|         self.assertIn(repr(f), | ||||
|                       ['{}({!r}, {})'.format(name, capture, kwargs_repr) | ||||
|                        for kwargs_repr in kwargs_reprs]) | ||||
| 
 | ||||
|         f = self.partial(capture, *args, **kwargs) | ||||
|         self.assertEqual('{}({!r}, {}, {})'.format(name, capture, args_repr, kwargs_repr), | ||||
|                          repr(f)) | ||||
|         self.assertIn(repr(f), | ||||
|                       ['{}({!r}, {}, {})'.format(name, capture, args_repr, kwargs_repr) | ||||
|                        for kwargs_repr in kwargs_reprs]) | ||||
| 
 | ||||
|     def test_pickle(self): | ||||
|         f = self.partial(signature, 'asdf', bar=True) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka