diff --git a/sphinx_parser/toolkit.py b/sphinx_parser/toolkit.py index 9c057f2..8706313 100644 --- a/sphinx_parser/toolkit.py +++ b/sphinx_parser/toolkit.py @@ -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) diff --git a/tests/unit/test_input.py b/tests/unit/test_input.py index a31b683..b7d4935 100644 --- a/tests/unit/test_input.py +++ b/tests/unit/test_input.py @@ -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): @@ -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()