Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sphinx_parser/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def fill_values(wrap_string: bool = True, **kwargs) -> dict:
for k, v in kwargs.items():
while k.endswith("_"):
k = k[:-1]
if v is not None and v is not False:
if v is not None:
if isinstance(v, list) and len(v) > 0 and isinstance(v[0], dict):
for i, vv in enumerate(v):
group = append_item(group, k, vv)
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pint import UnitRegistry

from sphinx_parser.input import sphinx
from sphinx_parser.toolkit import to_sphinx
from sphinx_parser.toolkit import fill_values, to_sphinx


class TestInput(unittest.TestCase):
Expand Down Expand Up @@ -49,6 +49,12 @@ def test_units(self):
{"dEnergy": 3.6749322175664394e-09, "maxSteps": 10, "blockCCG": {}},
)

def test_boolean(self):
self.assertEqual(
to_sphinx(fill_values(hello=True, world=[{"a": True}, {"a": False}])),
"hello = true;\nworld {\n\ta = true;\n}\nworld {\n\ta = false;\n}\n",
)


if __name__ == "__main__":
unittest.main()
Loading