Skip to content
Snippets Groups Projects
Commit a36dcbfc authored by Stuart D. Gathman's avatar Stuart D. Gathman
Browse files

All unittests pass in py2 and py3!

parent 626d5ae2
Branches
No related tags found
No related merge requests found
...@@ -54,11 +54,11 @@ def is_dynip(host,addr): ...@@ -54,11 +54,11 @@ def is_dynip(host,addr):
if host.find(addr) >= 0: return True if host.find(addr) >= 0: return True
if addr.find(':') >= 0: return False # IP6 if addr.find(':') >= 0: return False # IP6
a = addr.split('.') a = addr.split('.')
ia = map(int,a) ia = list(map(int,a))
h = host h = host
m = ip3.findall(host) m = ip3.findall(host)
if m: if m:
g = map(int,m)[:4] g = list(map(int,m))[:4]
ia3 = (ia[1:],ia[:3]) ia3 = (ia[1:],ia[:3])
if g[-3:] in ia3: return True if g[-3:] in ia3: return True
if g[0] == ia[3] and g[1:3] == ia[:2]: return True if g[0] == ia[3] and g[1:3] == ia[:2]: return True
......
...@@ -133,7 +133,7 @@ def parseaddr(t): ...@@ -133,7 +133,7 @@ def parseaddr(t):
>>> parseaddr('God@heaven <@hop1.org,@hop2.net:jeff@spec.org>') >>> parseaddr('God@heaven <@hop1.org,@hop2.net:jeff@spec.org>')
('God@heaven', 'jeff@spec.org') ('God@heaven', 'jeff@spec.org')
>>> parseaddr('Real Name ((comment)) <addr...@example.com>') >>> parseaddr('Real Name ((comment)) <addr...@example.com>')
('Real Name', 'addr...@example.com') ('Real Name (comment)', 'addr...@example.com')
>>> parseaddr('a(WRONG)@b') >>> parseaddr('a(WRONG)@b')
('WRONG', 'a@b') ('WRONG', 'a@b')
""" """
......
...@@ -43,7 +43,7 @@ class AddrCacheTestCase(unittest.TestCase): ...@@ -43,7 +43,7 @@ class AddrCacheTestCase(unittest.TestCase):
def testParseHeader(self): def testParseHeader(self):
s='=?UTF-8?B?TGFzdCBGZXcgQ29sZHBsYXkgQWxidW0gQXJ0d29ya3MgQXZhaWxhYmxlAA?=' s='=?UTF-8?B?TGFzdCBGZXcgQ29sZHBsYXkgQWxidW0gQXJ0d29ya3MgQXZhaWxhYmxlAA?='
h = Milter.utils.parse_header(s) h = Milter.utils.parse_header(s)
self.assertEqual(h,'Last Few Coldplay Album Artworks Available\x00') self.assertEqual(h,b'Last Few Coldplay Album Artworks Available\x00')
def suite(): def suite():
s = unittest.makeSuite(AddrCacheTestCase,'test') s = unittest.makeSuite(AddrCacheTestCase,'test')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment