From de8541cccdd54f12853c0c1b142a298fb09ce65c Mon Sep 17 00:00:00 2001 From: Per von Zweigbergk Date: Fri, 8 Sep 2023 21:56:39 +0200 Subject: [PATCH] Fix tests for test_invalid_range_alphanumeric For some reason, the current test suite expects expand_alphanumeric_pattern('r[9-a]a') to return an empty list and not thow an exception like it does in all other error cases? That makes no sense. --- netbox/utilities/tests/test_forms.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/netbox/utilities/tests/test_forms.py b/netbox/utilities/tests/test_forms.py index 0a4ecb795..999e7290d 100644 --- a/netbox/utilities/tests/test_forms.py +++ b/netbox/utilities/tests/test_forms.py @@ -269,8 +269,11 @@ class ExpandAlphanumeric(TestCase): sorted(expand_alphanumeric_pattern('r[8--9]a')) 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):