1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #12639 - Make sure name expansions throws a validation error on decrementing ranges (#13326)

* Fixes #12639 - Make sure name expansions throws a validation error on decrementing ranges

* Fix pep8

* Also fail on equal start & end values

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
kkthxbye
2023-08-11 17:53:16 +02:00
committed by GitHub
parent 40afe6cf36
commit 5de9d3f15f
3 changed files with 14 additions and 3 deletions

View File

@@ -264,8 +264,9 @@ class ExpandAlphanumeric(TestCase):
self.assertEqual(sorted(expand_alphanumeric_pattern('r[a-9]a')), [])
def test_invalid_range_bounds(self):
self.assertEqual(sorted(expand_alphanumeric_pattern('r[9-8]a')), [])
self.assertEqual(sorted(expand_alphanumeric_pattern('r[b-a]a')), [])
with self.assertRaises(forms.ValidationError):
sorted(expand_alphanumeric_pattern('r[9-8]a'))
sorted(expand_alphanumeric_pattern('r[b-a]a'))
def test_invalid_range_len(self):
with self.assertRaises(forms.ValidationError):