# 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 unittest
import uqbar.graphs
from uqbar.strings import normalize
class TestCase(unittest.TestCase):
    def test___init__(self):
        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        uqbar.graphs.Edge().attach(node_a, node_b)

    def test___format___str(self):
        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        edge = uqbar.graphs.Edge().attach(node_a, node_b)
        assert format(edge) == repr(edge)

        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        attributes = uqbar.graphs.Attributes(
            mode="edge", color="blue", style=["dotted"]
        )
        edge = uqbar.graphs.Edge(attributes=attributes).attach(node_a, node_b)
        assert format(edge) == repr(edge)

    def test___format___graphviz(self):
        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        edge = uqbar.graphs.Edge().attach(node_a, node_b)
        assert format(edge, "graphviz") == "foo -> bar;"

        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        attributes = uqbar.graphs.Attributes(
            mode="edge", color="blue", style=["dotted"]

# 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_graphs_Edge.py
import unittest
import uqbar.graphs
from uqbar.strings import normalize

class TestCase(unittest.TestCase):
    def test___init__(self):
        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        uqbar.graphs.Edge().attach(node_a, node_b)

    def test___format___str(self):
        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        edge = uqbar.graphs.Edge().attach(node_a, node_b)
        assert format(edge) == repr(edge)

        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        attributes = uqbar.graphs.Attributes(
            mode="edge", color="blue", style=["dotted"]
        )
        edge = uqbar.graphs.Edge(attributes=attributes).attach(node_a, node_b)
        assert format(edge) == repr(edge)

    def test___format___graphviz(self):
        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        edge = uqbar.graphs.Edge().attach(node_a, node_b)
        assert format(edge, "graphviz") == "foo -> bar;"

        node_a = uqbar.graphs.Node(name="foo")
        node_b = uqbar.graphs.Node(name="bar")
        attributes = uqbar.graphs.Attributes(
            mode="edge", color="blue", style=["dotted"]

        )