fixed hostname not split (+) in python (#609)

* fixed hostname not split (+) in python

* also for rx_hostname
This commit is contained in:
Erik Fröjdh
2023-01-16 13:33:11 +01:00
committed by GitHub
parent b02bda053b
commit d106109f6c
3 changed files with 53 additions and 10 deletions

View File

@ -341,4 +341,33 @@ def test_merge_args_tuple():
assert merge_args(*("a", "b"), 5) == ("a", "b", 5)
def test_merge_args_dict_with_tuple():
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)
def test_hostname_to_list():
s = "localhost"
r = hostname_list(s)
assert r == [s]
def test_hostname_to_list_passthrough():
args = ["localhost"]
ret = hostname_list(args)
assert ret == args
args = ("localhost",)
ret = hostname_list(args)
assert ret == args
def test_splitting_hostname():
args = 'apple+banana+pear+'
ret = hostname_list(args)
assert ret == ['apple', 'banana', 'pear']
#not sensitive to trailing +
args = 'apple+banana+pear'
ret = hostname_list(args)
assert ret == ['apple', 'banana', 'pear']
def test_hostame_throws_on_wrong_args():
with pytest.raises(Exception) as e:
hostname_list(5)