diff --git a/src/pyhf/writexml.py b/src/pyhf/writexml.py index 8d3ecd3ca3..ff7aac800b 100644 --- a/src/pyhf/writexml.py +++ b/src/pyhf/writexml.py @@ -56,7 +56,7 @@ def _export_root_histogram(hist_name, data): # https://stackoverflow.com/a/4590052 def indent(elem, level=0): i = "\n" + level * " " - if elem: + if elem is not None: if not elem.text or not elem.text.strip(): elem.text = i + " " if not elem.tail or not elem.tail.strip(): diff --git a/tests/test_export.py b/tests/test_export.py index bba0aa224e..5c1ebed6e2 100644 --- a/tests/test_export.py +++ b/tests/test_export.py @@ -447,7 +447,7 @@ def test_integer_data(datadir, mocker): mocker.patch("pyhf.writexml._ROOT_DATA_FILE") channel = pyhf.writexml.build_channel(spec, channel_spec, {}) - assert channel + assert channel is not None @pytest.mark.parametrize(