Merge branch 'comments-white-space' of polyzen/borgmatic into master
This commit is contained in:
commit
f2198de151
2 changed files with 12 additions and 12 deletions
|
@ -45,10 +45,10 @@ def _comment_out_line(line):
|
||||||
# Comment out the names of optional sections.
|
# Comment out the names of optional sections.
|
||||||
one_indent = ' ' * INDENT
|
one_indent = ' ' * INDENT
|
||||||
if not line.startswith(one_indent):
|
if not line.startswith(one_indent):
|
||||||
return '#' + line
|
return '# ' + line
|
||||||
|
|
||||||
# Otherwise, comment out the line, but insert the "#" after the first indent for aesthetics.
|
# Otherwise, comment out the line, but insert the "#" after the first indent for aesthetics.
|
||||||
return '#'.join((one_indent, line[INDENT:]))
|
return '# '.join((one_indent, line[INDENT:]))
|
||||||
|
|
||||||
|
|
||||||
REQUIRED_KEYS = {'source_directories', 'repositories', 'keep_daily'}
|
REQUIRED_KEYS = {'source_directories', 'repositories', 'keep_daily'}
|
||||||
|
|
|
@ -31,17 +31,17 @@ def test_comment_out_line_skips_already_commented_out_line():
|
||||||
def test_comment_out_line_comments_section_name():
|
def test_comment_out_line_comments_section_name():
|
||||||
line = 'figgy-pudding:'
|
line = 'figgy-pudding:'
|
||||||
|
|
||||||
assert module._comment_out_line(line) == '#' + line
|
assert module._comment_out_line(line) == '# ' + line
|
||||||
|
|
||||||
|
|
||||||
def test_comment_out_line_comments_indented_option():
|
def test_comment_out_line_comments_indented_option():
|
||||||
line = ' enabled: true'
|
line = ' enabled: true'
|
||||||
|
|
||||||
assert module._comment_out_line(line) == ' #enabled: true'
|
assert module._comment_out_line(line) == ' # enabled: true'
|
||||||
|
|
||||||
|
|
||||||
def test_comment_out_optional_configuration_comments_optional_config_only():
|
def test_comment_out_optional_configuration_comments_optional_config_only():
|
||||||
flexmock(module)._comment_out_line = lambda line: '#' + line
|
flexmock(module)._comment_out_line = lambda line: '# ' + line
|
||||||
config = '''
|
config = '''
|
||||||
foo:
|
foo:
|
||||||
bar:
|
bar:
|
||||||
|
@ -57,17 +57,17 @@ location:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
expected_config = '''
|
expected_config = '''
|
||||||
#foo:
|
# foo:
|
||||||
# bar:
|
# bar:
|
||||||
# - baz
|
# - baz
|
||||||
# - quux
|
# - quux
|
||||||
#
|
#
|
||||||
location:
|
location:
|
||||||
repositories:
|
repositories:
|
||||||
- one
|
- one
|
||||||
- two
|
- two
|
||||||
#
|
#
|
||||||
# other: thing
|
# other: thing
|
||||||
'''
|
'''
|
||||||
|
|
||||||
assert module._comment_out_optional_configuration(config.strip()) == expected_config.strip()
|
assert module._comment_out_optional_configuration(config.strip()) == expected_config.strip()
|
||||||
|
|
Loading…
Reference in a new issue