Repository: splunk/addonfactory-splunk-conf-parser-lib (language: python)

Issue:
`item_dict` does not return a stanza if it's empty
Example:
```
[stanza_with_something]
key = value

[empty_stanza]
```

Reproduce:
```
import addonfactory_splunk_conf_parser_lib as conf_parser

conf = """
[stanza_with_something]
key = value

[empty_stanza]
"""
parser = conf_parser.TABConfigParser()
parser.read_string(conf)
print(parser.item_dict())
```


Current behaviour:
```
{'stanza_with_something': {'key': 'value'}}
```

Potential (?) behaviour:
```
{'empty_stanza': {}, 'stanza_with_something': {'key': 'value'}}
```



Discussion / hints:

Fix patch:
diff --git a/addonfactory_splunk_conf_parser_lib.py b/addonfactory_splunk_conf_parser_lib.py
index 97a9878..e24b965 100644
--- a/addonfactory_splunk_conf_parser_lib.py
+++ b/addonfactory_splunk_conf_parser_lib.py
@@ -227,6 +227,5 @@ def item_dict(self):
                 ):
                     continue
                 kv[k] = v
-            if kv:
-                res[section] = kv
+            res[section] = kv
         return res


Test patch:
diff --git a/test_addonfactory_splunk_conf_parser_lib.py b/test_addonfactory_splunk_conf_parser_lib.py
index 7e4c515..66df484 100644
--- a/test_addonfactory_splunk_conf_parser_lib.py
+++ b/test_addonfactory_splunk_conf_parser_lib.py
@@ -163,6 +163,41 @@ def test_item_dict(self):
         }
         self.assertEqual(expected_item_dict, parser.item_dict())
 
+    def test_item_dict_when_there_is_empty_stanza(self):
+        conf = """
+[stanza_with_something]
+key = value
+
+[empty_stanza]
+"""
+        parser = conf_parser.TABConfigParser()
+        parser.read_string(conf)
+        expected_item_dict = {
+            "stanza_with_something": {
+                "key": "value",
+            },
+            "empty_stanza": {},
+        }
+        self.assertEqual(expected_item_dict, parser.item_dict())
+
+    def test_item_dict_when_there_is_empty_stanza_and_comment(self):
+        conf = """
+[stanza_with_something]
+key = value
+
+[empty_stanza]
+# This is a comment
+"""
+        parser = conf_parser.TABConfigParser()
+        parser.read_string(conf)
+        expected_item_dict = {
+            "stanza_with_something": {
+                "key": "value",
+            },
+            "empty_stanza": {},
+        }
+        self.assertEqual(expected_item_dict, parser.item_dict())
+
     def test_remove_existing_section(self):
         conf = """
 # Comment