+class TestEmail(unittest.TestCase):
+ def setUp(self):
+ self.good_addresses = ['office@example.com', 'winter+rodeln@localhost', 'joe.doe@exämple.com']
+ self.bad_addresses = ['öffice@example.com', 'winter rodeln@localhost', 'www.winterrodeln.org', 'mailto:info@example.com', 'info@example.com.']
+
+ def test_from_str(self):
+ for value in self.good_addresses:
+ self.assertEqual(value, email_from_str(value))
+ for value in self.bad_addresses:
+ with self.assertRaises(ValueError):
+ email_from_str(value)
+ print(value)
+
+ def test_to_str(self):
+ for value in self.good_addresses:
+ self.assertEqual(value, email_from_str(value))
+
+
+