def to_storage(self, subject): if subject is None: return None if isinstance(subject, (six.integer_types, float)): return six.text_type(subject) return helpers.ascii_text(subject)
def test_ascii_text_success_py3k(self): vals = [ (six.binary_type("The quick brown fox"), six.text_type("The quick brown fox")), (six.text_type("The quick brown fox").encode("utf-8"), six.text_type("The quick brown fox")), (six.text_type("The quick brown fox"), six.text_type("The quick brown fox")), ] for v, coerced in vals: self.assertEqual(coerced, helpers.ascii_text(v))