mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #49652 from rallytime/merge-2018.3
[2018.3] Merge forwrad from 2018.3.3 to 2018.3
This commit is contained in:
commit
aecbe12c8f
@ -105,19 +105,6 @@ class TestBuildWhitespaceRegex(TestCase):
|
||||
regex = salt.utils.stringutils.build_whitespace_split_regex(SINGLE_DOUBLE_SAME_LINE_TXT)
|
||||
self.assertTrue(re.search(regex, MATCH))
|
||||
|
||||
def test_build_whitespace_split_regex(self):
|
||||
# With 3.7+, re.escape only escapes special characters, no longer
|
||||
# escaping all characters other than ASCII letters, numbers and
|
||||
# underscores. This includes commas.
|
||||
if sys.version_info >= (3, 7):
|
||||
expected_regex = '(?m)^(?:[\\s]+)?Lorem(?:[\\s]+)?ipsum(?:[\\s]+)?dolor(?:[\\s]+)?sit(?:[\\s]+)?amet,' \
|
||||
'(?:[\\s]+)?$'
|
||||
else:
|
||||
expected_regex = '(?m)^(?:[\\s]+)?Lorem(?:[\\s]+)?ipsum(?:[\\s]+)?dolor(?:[\\s]+)?sit(?:[\\s]+)?amet\\,' \
|
||||
'(?:[\\s]+)?$'
|
||||
ret = salt.utils.stringutils.build_whitespace_split_regex(' '.join(LOREM_IPSUM.split()[:5]))
|
||||
self.assertEqual(ret, expected_regex)
|
||||
|
||||
|
||||
class StringutilsTestCase(TestCase):
|
||||
def test_contains_whitespace(self):
|
||||
@ -261,6 +248,19 @@ class StringutilsTestCase(TestCase):
|
||||
result = salt.utils.stringutils.to_unicode(LATIN1_BYTES, encoding=('utf-8', 'latin1'))
|
||||
assert result == LATIN1_UNICODE
|
||||
|
||||
def test_build_whitespace_split_regex(self):
|
||||
# With 3.7+, re.escape only escapes special characters, no longer
|
||||
# escaping all characters other than ASCII letters, numbers and
|
||||
# underscores. This includes commas.
|
||||
if sys.version_info >= (3, 7):
|
||||
expected_regex = '(?m)^(?:[\\s]+)?Lorem(?:[\\s]+)?ipsum(?:[\\s]+)?dolor(?:[\\s]+)?sit(?:[\\s]+)?amet,' \
|
||||
'(?:[\\s]+)?$'
|
||||
else:
|
||||
expected_regex = '(?m)^(?:[\\s]+)?Lorem(?:[\\s]+)?ipsum(?:[\\s]+)?dolor(?:[\\s]+)?sit(?:[\\s]+)?amet\\,' \
|
||||
'(?:[\\s]+)?$'
|
||||
ret = salt.utils.stringutils.build_whitespace_split_regex(' '.join(LOREM_IPSUM.split()[:5]))
|
||||
self.assertEqual(ret, expected_regex)
|
||||
|
||||
def test_get_context(self):
|
||||
expected_context = textwrap.dedent('''\
|
||||
---
|
||||
|
Loading…
Reference in New Issue
Block a user