Skip to content

Commit

Permalink
Consistent use of spaces + Python 2 & 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
hslatman committed Sep 28, 2015
1 parent 9635b6e commit 31e6639
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions platform/python/MailChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def is_valid(self, email):
return self.is_valid_email_format(email) and self.fake_matcher.search(email) == None

def is_valid_email_format(self, email):
if email:
if email and email != '':
return self.valid_matcher.search(email) != None
else:
return False
return False
4 changes: 2 additions & 2 deletions platform/python/MailChecker.tmpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def is_valid(self, email):
return self.is_valid_email_format(email) and self.fake_matcher.search(email) == None

def is_valid_email_format(self, email):
if email:
if email and email != '':
return self.valid_matcher.search(email) != None
else:
return False
return False
15 changes: 9 additions & 6 deletions test/platform.python.test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# compatibility with both Python 2.x and 3.x
from __future__ import print_function

# for testing only; add the python MailChecker to the system path
import os, sys
sys.path.insert(0, '../platform/python/')
Expand All @@ -7,9 +10,9 @@

m = MailChecker.MailChecker()

print m.is_valid('bla@example.com')
print m.is_valid('bla@yourlms.biz')
print m.is_valid('example@you.it')
print m.is_valid('bla@hotmail.com')
print m.is_valid('bla@yui.it')
print m.is_valid('')
print( m.is_valid('bla@example.com'))
print( m.is_valid('bla@yourlms.biz'))
print( m.is_valid('example@you.it'))
print( m.is_valid('bla@hotmail.com'))
print( m.is_valid('bla@yui.it'))
print( m.is_valid(''))

0 comments on commit 31e6639

Please sign in to comment.