def test_coerce_none_to_nullstring_success(self):
        subjects = [None]
        for subject in subjects:
            res = translators.coerce_none_to_nullstring(subject)
            self.assertEqual(six.text_type(""), res)

        subjects = ["this", six.b("this")]
        expected = ["this", six.b("this")]
        for subject, expected in zip(subjects, expected):
            res = translators.coerce_none_to_nullstring(subject)
            msg = "Failed to coerce %r to %r. Got %r instead."
            msg = msg % (subject, expected, res)
            self.assertEqual(expected, res, msg)
 def test_coerce_none_to_nullstring_failure(self):
     subjects = [123, 0, 456.78, object, [], {}]
     for subject in subjects:
         with testtools.ExpectedException(ValueError):
             translators.coerce_none_to_nullstring(subject)