Fix bogus test_invalid_range_alphanumeric test

Input errors should throw exceptions, not return an empty list. Should
not significantly change external behaviour, in the old versions a "Field is
required" message was an end result of these cases.
This commit is contained in:
Per von Zweigbergk 2023-09-09 14:46:46 +02:00
parent e485ed30c7
commit 9f3c15201a

View File

@ -275,8 +275,10 @@ class ExpandAlphanumeric(TestCase):
self.assertEqual(sorted(expand_alphanumeric_pattern(input)), output) self.assertEqual(sorted(expand_alphanumeric_pattern(input)), output)
def test_invalid_range_alphanumeric(self): def test_invalid_range_alphanumeric(self):
self.assertEqual(sorted(expand_alphanumeric_pattern('r[9-a]a')), []) with self.assertRaises(forms.ValidationError):
self.assertEqual(sorted(expand_alphanumeric_pattern('r[a-9]a')), []) sorted(expand_alphanumeric_pattern('r[9-a]a'))
with self.assertRaises(forms.ValidationError):
sorted(expand_alphanumeric_pattern('r[a-9]a'))
def test_invalid_range_bounds(self): def test_invalid_range_bounds(self):
with self.assertRaises(forms.ValidationError): with self.assertRaises(forms.ValidationError):