# Path: flatland/schema/scalars.py
# class String(Scalar):
#     """A regular old Unicode string."""
# 
#     strip = True
#     """If true, strip leading and trailing whitespace during conversion."""
# 
#     def adapt(self, value):
#         """Return a Unicode representation.
# 
#         :returns: a ``unicode`` value or ``None``
# 
#         If :attr:`strip` is true, leading and trailing whitespace will be
#         removed.
# 
#         """
#         if value is None:
#             return None
#         elif self.strip:
#             return unicode(value).strip()
#         else:
#             return unicode(value)
# 
#     def serialize(self, value):
#         """Return a Unicode representation.
# 
#         :returns: a ``unicode`` value or ``u'' if *value* is ``None``
# 
#         If :attr:`strip` is true, leading and trailing whitespace will be
#         removed.
# 
#         """
#         if value is None:
#             return u''
#         elif self.strip:
#             return unicode(value).strip()
#         else:
#             return unicode(value)
# 
#     @property
#     def is_empty(self):
#         """True if the String is missing or has no value."""
#         return True if (not self.value and self.u == u'') else False
# 
# Path: tests/genshi/_util.py
# class FilteredRenderTest(RenderTest):
#     def generate(self, template, context):
#         from flatland.out.genshi import flatland_filter
#         return flatland_filter(template.generate(context), context)
# 
# def from_docstring(context_factory=dict):
#     def wrap(fn):
#         def test(self, *args, **kw):
#             tests = self.from_string(fn.__doc__, context_factory,
#                                      name=fn.func_name)
#             for test, context, template in tests:
#                 yield test, context, template
#         test.func_name = fn.func_name
#         return test
#     return wrap


from flatland import String
from tests.genshi._util import (
    FilteredRenderTest,
    from_docstring,
    )
<form:with tabindex="1000">
<div form:auto-tabindex="on"/>
</form:with>
<div form:auto-tabindex="on"/>
:: eq
<div />
<div tabindex="1000" />
<div />
:: endtest

:: test domid format
<div form:bind="${field1.bind}" form:auto-domid="on" />

<form:with domid-format="id_%s_di">
<div form:bind="${field1.bind}" form:auto-domid="on" />
</form:with>

<div form:bind="${field1.bind}" form:auto-domid="on" />
:: eq
<div id="f_field1" />

<div id="id_field1_di" />

<div id="f_field1" />
:: endtest

        """


class TestSet(FilteredRenderTest):

# Path: flatland/schema/scalars.py
# class String(Scalar):
#     """A regular old Unicode string."""
# 
#     strip = True
#     """If true, strip leading and trailing whitespace during conversion."""
# 
#     def adapt(self, value):
#         """Return a Unicode representation.
# 
#         :returns: a ``unicode`` value or ``None``
# 
#         If :attr:`strip` is true, leading and trailing whitespace will be
#         removed.
# 
#         """
#         if value is None:
#             return None
#         elif self.strip:
#             return unicode(value).strip()
#         else:
#             return unicode(value)
# 
#     def serialize(self, value):
#         """Return a Unicode representation.
# 
#         :returns: a ``unicode`` value or ``u'' if *value* is ``None``
# 
#         If :attr:`strip` is true, leading and trailing whitespace will be
#         removed.
# 
#         """
#         if value is None:
#             return u''
#         elif self.strip:
#             return unicode(value).strip()
#         else:
#             return unicode(value)
# 
#     @property
#     def is_empty(self):
#         """True if the String is missing or has no value."""
#         return True if (not self.value and self.u == u'') else False
# 
# Path: tests/genshi/_util.py
# class FilteredRenderTest(RenderTest):
#     def generate(self, template, context):
#         from flatland.out.genshi import flatland_filter
#         return flatland_filter(template.generate(context), context)
# 
# def from_docstring(context_factory=dict):
#     def wrap(fn):
#         def test(self, *args, **kw):
#             tests = self.from_string(fn.__doc__, context_factory,
#                                      name=fn.func_name)
#             for test, context, template in tests:
#                 yield test, context, template
#         test.func_name = fn.func_name
#         return test
#     return wrap


# Path: tests/genshi/test_directives.py
from flatland import String
from tests.genshi._util import (
    FilteredRenderTest,
    from_docstring,
    )

<form:with tabindex="1000">
<div form:auto-tabindex="on"/>
</form:with>
<div form:auto-tabindex="on"/>
:: eq
<div />
<div tabindex="1000" />
<div />
:: endtest

:: test domid format
<div form:bind="${field1.bind}" form:auto-domid="on" />

<form:with domid-format="id_%s_di">
<div form:bind="${field1.bind}" form:auto-domid="on" />
</form:with>

<div form:bind="${field1.bind}" form:auto-domid="on" />
:: eq
<div id="f_field1" />

<div id="id_field1_di" />

<div id="f_field1" />
:: endtest

        """


class TestSet(FilteredRenderTest):

    @from_docstring(context_factory=simple_context)