mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #49633 from garethgreenaway/moving_test_into_correct_class
[2018.3.3] Moving test_build_whitespace_split_regex to TestBuildWhitespaceRegex
This commit is contained in:
commit
0096cf10b5
1 changed files with 9 additions and 15 deletions
|
@ -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):
|
||||
|
@ -262,8 +249,15 @@ class StringutilsTestCase(TestCase):
|
|||
assert result == LATIN1_UNICODE
|
||||
|
||||
def test_build_whitespace_split_regex(self):
|
||||
expected_regex = '(?m)^(?:[\\s]+)?Lorem(?:[\\s]+)?ipsum(?:[\\s]+)?dolor(?:[\\s]+)?sit(?:[\\s]+)?amet\\,' \
|
||||
'(?:[\\s]+)?$'
|
||||
# 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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue