diff --git a/metricflow-semantics/metricflow_semantics/dag/dag_to_text.py b/metricflow-semantics/metricflow_semantics/dag/dag_to_text.py index 5b3ea8ad58..97da528a09 100644 --- a/metricflow-semantics/metricflow_semantics/dag/dag_to_text.py +++ b/metricflow-semantics/metricflow_semantics/dag/dag_to_text.py @@ -34,7 +34,7 @@ def __init__(self, max_width: int) -> None: # noqa: D107 def update_max_width_for_indented_section(self, indent_prefix: str) -> Iterator[None]: """Context manager used to wrap the code that prints an indented section.""" previous_max_width = self._current_max_width - self._current_max_width = max(0, self._current_max_width - len(indent_prefix)) + self._current_max_width = max(1, self._current_max_width - len(indent_prefix)) yield None self._current_max_width = previous_max_width @@ -101,7 +101,7 @@ def _format_to_text(self, node: DagNode, inner_contents: Optional[str]) -> str: displayed_property.value, # The string representation of displayed_property.value will be wrapped with "" so subtract # the width of those. - max_line_length=max_width - len(""), + max_line_length=max(1, max_width - len("")), indent_prefix=self._value_indent_prefix, ) diff --git a/tests_metricflow/mf_logging/test_dag_to_text.py b/tests_metricflow/mf_logging/test_dag_to_text.py index bae02af948..06086744c5 100644 --- a/tests_metricflow/mf_logging/test_dag_to_text.py +++ b/tests_metricflow/mf_logging/test_dag_to_text.py @@ -70,11 +70,16 @@ def _run_mf_pformat() -> None: - - - - - + + + + + + + + + + @@ -82,12 +87,16 @@ def _run_mf_pformat() -> None: - - - - - - + + + + + + + + + +