mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Use os.linesep.join instead of textwrap.dedent
This commit is contained in:
parent
5ba7f60f03
commit
d3358423ae
1 changed files with 52 additions and 52 deletions
|
@ -5,7 +5,7 @@ Tests for the file state
|
|||
'''
|
||||
|
||||
# Import python libs
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
import errno
|
||||
import glob
|
||||
import logging
|
||||
|
@ -2647,57 +2647,57 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
class BlockreplaceTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
marker_start = '# start'
|
||||
marker_end = '# end'
|
||||
content = textwrap.dedent('''\
|
||||
Line 1 of block
|
||||
Line 2 of block
|
||||
''')
|
||||
without_block = textwrap.dedent('''\
|
||||
Hello world!
|
||||
|
||||
# comment here
|
||||
''')
|
||||
with_non_matching_block = textwrap.dedent('''\
|
||||
Hello world!
|
||||
|
||||
# start
|
||||
No match here
|
||||
# end
|
||||
# comment here
|
||||
''')
|
||||
with_non_matching_block_and_marker_end_not_after_newline = textwrap.dedent('''\
|
||||
Hello world!
|
||||
|
||||
# start
|
||||
No match here# end
|
||||
# comment here
|
||||
''')
|
||||
with_matching_block = textwrap.dedent('''\
|
||||
Hello world!
|
||||
|
||||
# start
|
||||
Line 1 of block
|
||||
Line 2 of block
|
||||
# end
|
||||
# comment here
|
||||
''')
|
||||
with_matching_block_and_extra_newline = textwrap.dedent('''\
|
||||
Hello world!
|
||||
|
||||
# start
|
||||
Line 1 of block
|
||||
Line 2 of block
|
||||
|
||||
# end
|
||||
# comment here
|
||||
''')
|
||||
with_matching_block_and_marker_end_not_after_newline = textwrap.dedent('''\
|
||||
Hello world!
|
||||
|
||||
# start
|
||||
Line 1 of block
|
||||
Line 2 of block# end
|
||||
# comment here
|
||||
''')
|
||||
content = os.linesep.join([
|
||||
'Line 1 of block',
|
||||
'Line 2 of block',
|
||||
''])
|
||||
without_block = os.linesep.join([
|
||||
'Hello world!',
|
||||
'',
|
||||
'# comment here',
|
||||
''])
|
||||
with_non_matching_block = os.linesep.join([
|
||||
'Hello world!',
|
||||
'',
|
||||
'# start',
|
||||
'No match here',
|
||||
'# end',
|
||||
'# comment here',
|
||||
''])
|
||||
with_non_matching_block_and_marker_end_not_after_newline = os.linesep.join([
|
||||
'Hello world!',
|
||||
'',
|
||||
'# start',
|
||||
'No match here# end',
|
||||
'# comment here',
|
||||
''])
|
||||
with_matching_block = os.linesep.join([
|
||||
'Hello world!',
|
||||
'',
|
||||
'# start',
|
||||
'Line 1 of block',
|
||||
'Line 2 of block',
|
||||
'# end',
|
||||
'# comment here',
|
||||
''])
|
||||
with_matching_block_and_extra_newline = os.linesep.join([
|
||||
'Hello world!',
|
||||
'',
|
||||
'# start',
|
||||
'Line 1 of block',
|
||||
'Line 2 of block',
|
||||
'',
|
||||
'# end',
|
||||
'# comment here',
|
||||
''])
|
||||
with_matching_block_and_marker_end_not_after_newline = os.linesep.join([
|
||||
'Hello world!',
|
||||
'',
|
||||
'# start',
|
||||
'Line 1 of block',
|
||||
'Line 2 of block# end',
|
||||
'# comment here',
|
||||
''])
|
||||
content_explicit_posix_newlines = ('Line 1 of block\n'
|
||||
'Line 2 of block\n')
|
||||
content_explicit_windows_newlines = ('Line 1 of block\r\n'
|
||||
|
|
Loading…
Add table
Reference in a new issue