From 9f3c15201a156e4853770693fa976350ff808899 Mon Sep 17 00:00:00 2001 From: Per von Zweigbergk Date: Sat, 9 Sep 2023 14:46:46 +0200 Subject: [PATCH] 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. --- netbox/utilities/tests/test_forms.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/netbox/utilities/tests/test_forms.py b/netbox/utilities/tests/test_forms.py index 44b52b68c..f6a5527cb 100644 --- a/netbox/utilities/tests/test_forms.py +++ b/netbox/utilities/tests/test_forms.py @@ -275,8 +275,10 @@ class ExpandAlphanumeric(TestCase): self.assertEqual(sorted(expand_alphanumeric_pattern(input)), output) def test_invalid_range_alphanumeric(self): - self.assertEqual(sorted(expand_alphanumeric_pattern('r[9-a]a')), []) - self.assertEqual(sorted(expand_alphanumeric_pattern('r[a-9]a')), []) + with self.assertRaises(forms.ValidationError): + 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): with self.assertRaises(forms.ValidationError):