Skip to content

Commit 9108872

Browse files
DelganFlorianWilhelm
authored andcommitted
Add test for comment in section names
1 parent 8b6a216 commit 9108872

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_configupdater.py

+14
Original file line numberDiff line numberDiff line change
@@ -1602,3 +1602,17 @@ def test_parsing_of_brackets_in_section_names():
16021602
updater = ConfigUpdater()
16031603
updater.read_string(cfg)
16041604
assert updater.sections() == [" ", "[]", "][", "]#"]
1605+
1606+
1607+
def test_parsing_of_brackets_in_section_names_comments():
1608+
cfg = """\
1609+
[section-A] # comment telling that this section is related to [section-B]
1610+
foo = bar
1611+
1612+
[section-B] ; comment telling that this section is related to [section-A]
1613+
bar = foo
1614+
"""
1615+
cfg = dedent(cfg)
1616+
updater = ConfigUpdater(inline_comment_prefixes=("#", ";"))
1617+
updater.read_string(cfg)
1618+
assert updater.sections() == ["section-A", "section-B"]

0 commit comments

Comments
 (0)