mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 04:58:16 -06:00
Fixes: #13722 - Correct range expansion code when a numeric set is used
This commit is contained in:
parent
edb7d24b45
commit
017a66b5f9
@ -60,7 +60,7 @@ def parse_alphanumeric_range(string):
|
||||
return []
|
||||
except ValueError:
|
||||
begin, end = dash_range, dash_range
|
||||
if begin.isdigit() and end.isdigit():
|
||||
if begin.isdigit() and end.isdigit() and not begin == end:
|
||||
if int(begin) >= int(end):
|
||||
raise forms.ValidationError(_('Range "{value}" is invalid.').format(value=dash_range))
|
||||
|
||||
|
@ -191,7 +191,16 @@ class ExpandAlphanumeric(TestCase):
|
||||
|
||||
self.assertEqual(sorted(expand_alphanumeric_pattern(input)), output)
|
||||
|
||||
def test_set(self):
|
||||
def test_set_numeric(self):
|
||||
input = 'r[1,2]a'
|
||||
output = sorted([
|
||||
'r1a',
|
||||
'r2a',
|
||||
])
|
||||
|
||||
self.assertEqual(sorted(expand_alphanumeric_pattern(input)), output)
|
||||
|
||||
def test_set_alpha(self):
|
||||
input = '[r,t]1a'
|
||||
output = sorted([
|
||||
'r1a',
|
||||
|
Loading…
Reference in New Issue
Block a user