changeset 8356:3d3c7481aede

inifile: add doctest coverage of comment corner cases Shows room for improvement - doesn't show any bugs.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 22 Apr 2020 16:21:23 +0200
parents 269ba8809002
children 238885eaead4
files kallithea/lib/inifile.py
diffstat 1 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/inifile.py	Tue Apr 14 13:23:02 2020 +0200
+++ b/kallithea/lib/inifile.py	Wed Apr 22 16:21:23 2020 +0200
@@ -67,11 +67,22 @@
     ... %elif conditional_options == 'option-b':
     ... some_variable = "never mind - option-b will not be used anyway ..."
     ... %endif
+    ...
+    ... [comment-section]
+    ... #variable3 = 3.0
+    ... #variable4 = 4.0
+    ... #variable5 = 5.0
+    ... variable5 = 5.1
+    ... #variable6 = 6.0
+    ... #variable6 = 6.1
+    ... #variable7 = 7.0
+    ... variable7 = 7.1
     ... '''
     >>> mako_variable_values = {'mako_variable': 'VALUE', 'mako_function': (lambda: 'FUNCTION RESULT'),
     ...                         'conditional_options': 'option-a', 'http_server': 'nc'}
     >>> settings = { # only partially used
     ...     '[first-section]': {'variable2': 'VAL2', 'first_extra': 'EXTRA'},
+    ...     '[comment-section]': {'variable3': '3.0', 'variable4': '4.1', 'variable5': '5.2', 'variable6': '6.2', 'variable7': '7.0'},
     ...     '[third-section]': {'third_extra': ' 3'},
     ...     '[fourth-section]': {'fourth_extra': '4', 'fourth': '"four"'},
     ... }
@@ -91,6 +102,22 @@
     [second-section]
     # option a was chosen
     <BLANKLINE>
+    [comment-section]
+    #variable3 = 3.0
+    #variable4 = 4.0
+    #variable5 = 5.0
+    #variable5 = 5.1
+    variable5 = 5.2
+    #variable6 = 6.0
+    #variable6 = 6.1
+    #variable7 = 7.0
+    #variable7 = 7.1
+    variable7 = 7.0
+    <BLANKLINE>
+    variable3 = 3.0
+    variable4 = 4.1
+    variable6 = 6.2
+    <BLANKLINE>
     [fourth-section]
     fourth = "four"
     fourth_extra = 4