2015-09-07 00:33:56 +02:00
|
|
|
import string
|
2019-05-13 23:39:10 +02:00
|
|
|
from collections import OrderedDict
|
|
|
|
from io import StringIO
|
2015-09-07 00:33:56 +02:00
|
|
|
|
2017-07-05 01:52:24 +02:00
|
|
|
from borgmatic.config import legacy as module
|
2015-09-07 00:33:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_parse_section_options_with_punctuation_should_return_section_options():
|
|
|
|
parser = module.RawConfigParser()
|
2023-03-24 07:11:14 +01:00
|
|
|
parser.read_file(StringIO(f'[section]\nfoo: {string.punctuation}\n'))
|
2015-09-07 00:33:56 +02:00
|
|
|
|
|
|
|
section_format = module.Section_format(
|
2018-09-30 07:45:00 +02:00
|
|
|
'section', (module.Config_option('foo', str, required=True),)
|
2015-09-07 00:33:56 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
config = module.parse_section_options(parser, section_format)
|
|
|
|
|
2018-09-30 07:45:00 +02:00
|
|
|
assert config == OrderedDict((('foo', string.punctuation),))
|