mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	without handler.
This commit is contained in:
		
							parent
							
								
									c6057c7812
								
							
						
					
					
						commit
						f91149e4a1
					
				
					 2 changed files with 10 additions and 0 deletions
				
			
		|  | @ -381,6 +381,12 @@ def find_user_password(self, realm, authuri): | |||
| 
 | ||||
| class OpenerDirectorTests(unittest.TestCase): | ||||
| 
 | ||||
|     def test_add_non_handler(self): | ||||
|         class NonHandler(object): | ||||
|             pass | ||||
|         self.assertRaises(TypeError, | ||||
|                           OpenerDirector().add_handler, NonHandler()) | ||||
| 
 | ||||
|     def test_badly_named_methods(self): | ||||
|         # test work-around for three methods that accidentally follow the | ||||
|         # naming conventions for handler methods | ||||
|  |  | |||
|  | @ -295,6 +295,10 @@ def __init__(self): | |||
|         self.process_request = {} | ||||
| 
 | ||||
|     def add_handler(self, handler): | ||||
|         if not hasattr(handler, "add_parent"): | ||||
|             raise TypeError("expected BaseHandler instance, got %r" % | ||||
|                             type(handler)) | ||||
| 
 | ||||
|         added = False | ||||
|         for meth in dir(handler): | ||||
|             if meth in ["redirect_request", "do_open", "proxy_open"]: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Georg Brandl
						Georg Brandl