diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py index 852a7970ee..5d6c53afdd 100644 --- a/tests/utils_tests/test_text.py +++ b/tests/utils_tests/test_text.py @@ -225,6 +225,13 @@ class TestUtilsText(SimpleTestCase): self.assertEqual(text.unescape_string_literal(value), output) self.assertEqual(text.unescape_string_literal(lazystr(value)), output) + def test_unescape_string_literal_invalid_value(self): + items = ['abc', "'abc\""] + for item in items: + msg = f'Not a string literal: {item!r}' + with self.assertRaisesMessage(ValueError, msg): + text.unescape_string_literal(item) + def test_get_valid_filename(self): filename = "^&'@{}[],$=!-#()%+~_123.txt" self.assertEqual(text.get_valid_filename(filename), "-_123.txt")