borgmatic/tests/integration/config/test_legacy.py

20 lines
579 B
Python
Raw Normal View History

from io import StringIO
from collections import OrderedDict
import string
2017-07-05 01:52:24 +02:00
from borgmatic.config import legacy as module
def test_parse_section_options_with_punctuation_should_return_section_options():
parser = module.RawConfigParser()
2018-09-30 00:06:57 +02:00
parser.read_file(StringIO('[section]\nfoo: {}\n'.format(string.punctuation)))
section_format = module.Section_format(
'section', (module.Config_option('foo', str, required=True),)
)
config = module.parse_section_options(parser, section_format)
assert config == OrderedDict((('foo', string.punctuation),))