def test_bad_arg(self): """ Test exception for invalid argument type. """ with self.assertRaises(TypeError) as context: date_string(None) message = "need a date object" return
def test_normal(self): """ Test normal operation. """ date_obj = datetime.date(2012, 1, 1) date_str = "2012-01-01" # test for zero fill self.assertEqual(date_str, date_string(date_obj)) return