# 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 = uqbar.graphs.Node()
        assert node.name is None

        node = uqbar.graphs.Node(name="foo")
        assert node.name == "foo"
        assert not node.attributes

        attributes = uqbar.graphs.Attributes(mode="node", color="blue")
        node = uqbar.graphs.Node(name="foo", attributes=attributes)
        assert node.name == "foo"

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




class TestCase(unittest.TestCase):
    def test___init__(self):
        node = uqbar.graphs.Node()
        assert node.name is None

        node = uqbar.graphs.Node(name="foo")
        assert node.name == "foo"
        assert not node.attributes

        attributes = uqbar.graphs.Attributes(mode="node", color="blue")
        node = uqbar.graphs.Node(name="foo", attributes=attributes)
        assert node.name == "foo"

        assert len(node.attributes) == 1