Added test for ValueErrors in unescape_string_literal().
This commit is contained in:
parent
3b73f77ad4
commit
5d9c512e5b
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue