test_utils.py 451 B

12345678910111213
  1. from django.test import TestCase
  2. from ..utils import remove_bad_chars
  3. class UtilsTestCase(TestCase):
  4. def test_remove_bad_chars(self):
  5. self.assertEqual(remove_bad_chars({"\u0000a": " "}), {"a": " "})
  6. self.assertEqual(remove_bad_chars("\u0000"), "")
  7. self.assertEqual(remove_bad_chars(["\u0000"]), [""])
  8. self.assertEqual(
  9. remove_bad_chars([{"\u0000a": {"\u0000b": "b"}}]), [{"a": {"b": "b"}}]
  10. )