mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	Issue 1776581. Minor corrections to smtplib, and two small tests.
Thanks Alan McIntyre.
This commit is contained in:
		
							parent
							
								
									fc2d01032f
								
							
						
					
					
						commit
						1660933d23
					
				
					 2 changed files with 5 additions and 4 deletions
				
			
		|  | @ -298,7 +298,7 @@ def connect(self, host='localhost', port = 0): | ||||||
|     def send(self, str): |     def send(self, str): | ||||||
|         """Send `str' to the server.""" |         """Send `str' to the server.""" | ||||||
|         if self.debuglevel > 0: print>>stderr, 'send:', repr(str) |         if self.debuglevel > 0: print>>stderr, 'send:', repr(str) | ||||||
|         if self.sock: |         if hasattr(self, 'sock') and self.sock: | ||||||
|             try: |             try: | ||||||
|                 self.sock.sendall(str) |                 self.sock.sendall(str) | ||||||
|             except socket.error: |             except socket.error: | ||||||
|  | @ -486,7 +486,7 @@ def verify(self, address): | ||||||
|     vrfy=verify |     vrfy=verify | ||||||
| 
 | 
 | ||||||
|     def expn(self, address): |     def expn(self, address): | ||||||
|         """SMTP 'verify' command -- checks for address validity.""" |         """SMTP 'expn' command -- expands a mailing list.""" | ||||||
|         self.putcmd("expn", quoteaddr(address)) |         self.putcmd("expn", quoteaddr(address)) | ||||||
|         return self.getreply() |         return self.getreply() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -82,8 +82,9 @@ def testNotConnected(self): | ||||||
|         # to reference the nonexistent 'sock' attribute of the SMTP object |         # to reference the nonexistent 'sock' attribute of the SMTP object | ||||||
|         # causes an AttributeError) |         # causes an AttributeError) | ||||||
|         smtp = smtplib.SMTP() |         smtp = smtplib.SMTP() | ||||||
|         self.assertRaises(AttributeError, smtp.ehlo) |         self.assertRaises(smtplib.SMTPServerDisconnected, smtp.ehlo) | ||||||
|         self.assertRaises(AttributeError, smtp.send, 'test msg') |         self.assertRaises(smtplib.SMTPServerDisconnected, | ||||||
|  |                           smtp.send, 'test msg') | ||||||
| 
 | 
 | ||||||
|     def testLocalHostName(self): |     def testLocalHostName(self): | ||||||
|         # check that supplied local_hostname is used |         # check that supplied local_hostname is used | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Facundo Batista
						Facundo Batista