# Path: uqbar/strings.py
# def normalize(string: str) -> str:
#     """
#     Normalizes whitespace.
# 
#     Strips leading and trailing blank lines, dedents, and removes trailing
#     whitespace from the result.
#     """
#     string = string.replace("\t", "    ")
#     lines = string.split("\n")
#     while lines and (not lines[0] or lines[0].isspace()):
#         lines.pop(0)
#     while lines and (not lines[-1] or lines[-1].isspace()):
#         lines.pop()
#     for i, line in enumerate(lines):
#         lines[i] = line.rstrip()
#     string = "\n".join(lines)
#     string = textwrap.dedent(string)
#     return string


import pathlib
import sys
import pytest
import uqbar.apis
from uqbar.strings import normalize
           :undoc-members:

        .. raw:: html

           <hr/>

        .. rubric:: Functions
           :class: section-header

        .. autosummary::
           :nosignatures:

           ~_private_function
           ~public_function

        .. autofunction:: _private_function

        .. autofunction:: public_function
        """
    )


def test_str_03(test_path):
    documenter = uqbar.apis.SummarizingModuleDocumenter(
        "fake_package.module",
        member_documenter_classes=[
            uqbar.apis.FunctionDocumenter,
            uqbar.apis.SummarizingClassDocumenter,
        ],
    )

# Path: uqbar/strings.py
# def normalize(string: str) -> str:
#     """
#     Normalizes whitespace.
# 
#     Strips leading and trailing blank lines, dedents, and removes trailing
#     whitespace from the result.
#     """
#     string = string.replace("\t", "    ")
#     lines = string.split("\n")
#     while lines and (not lines[0] or lines[0].isspace()):
#         lines.pop(0)
#     while lines and (not lines[-1] or lines[-1].isspace()):
#         lines.pop()
#     for i, line in enumerate(lines):
#         lines[i] = line.rstrip()
#     string = "\n".join(lines)
#     string = textwrap.dedent(string)
#     return string


# Path: tests/test_apis_SummarizingModuleDocumenter.py
import pathlib
import sys
import pytest
import uqbar.apis
from uqbar.strings import normalize

           :undoc-members:

        .. raw:: html

           <hr/>

        .. rubric:: Functions
           :class: section-header

        .. autosummary::
           :nosignatures:

           ~_private_function
           ~public_function

        .. autofunction:: _private_function

        .. autofunction:: public_function
        """
    )


def test_str_03(test_path):
    documenter = uqbar.apis.SummarizingModuleDocumenter(
        "fake_package.module",
        member_documenter_classes=[
            uqbar.apis.FunctionDocumenter,
            uqbar.apis.SummarizingClassDocumenter,
        ],
    )

    assert normalize(str(documenter)) == normalize(