def test_coerce_iso8601_string_success(self):
     subjects = [
         datetime.datetime(2015, 1, 23, 10, 36, 22, tzinfo=translators._UTC),
         datetime.datetime(2015, 1, 23, 10, 36, 22),
         "2015-01-23T10:36:22Z",
         "2015-01-23T10:36:22",
         "2015-01-23T10:36:22+00:00",
         "2015-01-23T10:36:22-00:00",
         1422009382,
         1422009382.00,
     ]
     expected = six.text_type("2015-01-23T10:36:22+00:00")
     for subject in subjects:
         res = translators.coerce_iso8601_string(subject)
         msg = "Failed to coerce %r to %r. Got %r instead."
         msg = msg % (subject, expected, res)
         self.assertEqual(expected, res, msg)
 def test_coerce_iso8601_string_failure(self):
     subjects = ["123", object, [], {}, "2015-01-23F10:36:22-00:00"]
     for subject in subjects:
         with testtools.ExpectedException(ValueError):
             translators.coerce_iso8601_string(subject)