Package pyzmail :: Package tests :: Module test_generate
[hide private]
[frames] | no frames]

Source Code for Module pyzmail.tests.test_generate

 1  import unittest, doctest 
 2  import pyzmail 
 3  from pyzmail.generate import * 
 4   
5 -class TestGenerate(unittest.TestCase):
6
7 - def setUp(self):
8 pass
9
10 - def test_format_addresses(self):
11 """test format_addresse""" 12 self.assertEqual('foo@example.com', str(format_addresses([ 'foo@example.com', ]))) 13 self.assertEqual('Foo <foo@example.com>', str(format_addresses([ ('Foo', 'foo@example.com'), ]))) 14 # notice the space around the comma 15 self.assertEqual('foo@example.com , bar@example.com', str(format_addresses([ 'foo@example.com', 'bar@example.com']))) 16 # notice the space around the comma 17 self.assertEqual('Foo <foo@example.com> , Bar <bar@example.com>', str(format_addresses([ ('Foo', 'foo@example.com'), ( 'Bar', 'bar@example.com')])))
18 19 # Add doctest
20 -def load_tests(loader, tests, ignore):
21 # this works with python 2.7 and 3.x 22 tests.addTests(doctest.DocTestSuite(pyzmail.generate)) 23 return tests
24
25 -def additional_tests():
26 # Add doctest for python 2.6 and below 27 if sys.version_info<(2, 7): 28 return doctest.DocTestSuite(pyzmail.generate) 29 else: 30 return unittest.TestSuite()
31