mirror of
				https://github.com/Mikaela/Limnoria.git
				synced 2025-10-30 23:27:24 +01:00 
			
		
		
		
	Added emailRe to utils.net.
This commit is contained in:
		
							parent
							
								
									641c5cd634
								
							
						
					
					
						commit
						65893c8e3c
					
				| @ -31,8 +31,13 @@ | ||||
| Simple utility modules. | ||||
| """ | ||||
| 
 | ||||
| import re | ||||
| import socket | ||||
| 
 | ||||
| emailRe = re.compile(r"^(\w&.+-]+!)*[\w&.+-]+@" | ||||
|                      r"(([0-9a-z]([0-9a-z-]*[0-9a-z])?\.)[a-z]{2,6}|" | ||||
|                      r"([0-9]{1,3}\.){3}[0-9]{1,3})$", re.I)  | ||||
| 
 | ||||
| def getSocket(host): | ||||
|     """Returns a socket of the correct AF_INET type (v4 or v6) in order to | ||||
|     communicate with host. | ||||
|  | ||||
| @ -385,6 +385,10 @@ class FileTest(SupyTestCase): | ||||
| 
 | ||||
| 
 | ||||
| class NetTest(SupyTestCase): | ||||
|     def testEmailRe(self): | ||||
|         emailRe = utils.net.emailRe | ||||
|         self.failUnless(emailRe.match('jemfinch@supybot.com')) | ||||
| 
 | ||||
|     def testIsIP(self): | ||||
|         isIP = utils.net.isIP | ||||
|         self.failIf(isIP('a.b.c')) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jeremy Fincher
						Jeremy Fincher