summaryrefslogtreecommitdiff
path: root/test/units
diff options
context:
space:
mode:
authorSam Doran <sdoran@redhat.com>2019-09-20 16:03:51 -0400
committerGitHub <noreply@github.com>2019-09-20 16:03:51 -0400
commit987265a6ef920466b44625097ff85f3e845dc8ea (patch)
treede0ee35897219f38e25190a59e57b267a7110fd4 /test/units
parent8d0c193b251051e459513614e6f7212ecf9f0922 (diff)
downloadansible-987265a6ef920466b44625097ff85f3e845dc8ea.tar.gz
Account for empty strings when splitting the host pattern (#62442)
Improve tests - add more unit test cases - add specific integration test with more cases Testing shows no major downside to calling .strip() twice in a comprehension vs. using a regular for loop and only calling .strip() once. Going with the comprehension for ease of maintenance and because comprehensions are optimized in CPython.
Diffstat (limited to 'test/units')
-rw-r--r--test/units/plugins/inventory/test_inventory.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/units/plugins/inventory/test_inventory.py b/test/units/plugins/inventory/test_inventory.py
index 48c3f9834a..66b5ec3787 100644
--- a/test/units/plugins/inventory/test_inventory.py
+++ b/test/units/plugins/inventory/test_inventory.py
@@ -49,6 +49,10 @@ class TestInventory(unittest.TestCase):
'a:b': ['a', 'b'],
' a : b ': ['a', 'b'],
'foo:bar:baz[1:2]': ['foo', 'bar', 'baz[1:2]'],
+ 'a,,b': ['a', 'b'],
+ 'a, ,b,,c, ,': ['a', 'b', 'c'],
+ ',': [],
+ '': [],
}
pattern_lists = [