# Path: mako/lookup.py
# class TemplateCollection(object):
# class TemplateLookup(TemplateCollection):
#     def has_template(self, uri):
#     def get_template(self, uri, relativeto=None):
#     def filename_to_uri(self, uri, filename):
#     def adjust_uri(self, uri, filename):
#     def __init__(self, 
#                         directories=None, 
#                         module_directory=None, 
#                         filesystem_checks=True, 
#                         collection_size=-1, 
#                         format_exceptions=False, 
#                         error_handler=None, 
#                         disable_unicode=False, 
#                         output_encoding=None, 
#                         encoding_errors='strict', 
#                         cache_type=None, 
#                         cache_dir=None, cache_url=None,
#                         cache_enabled=True, 
#                         modulename_callable=None, 
#                         default_filters=None, 
#                         buffer_filters=(), 
#                         imports=None, 
#                         input_encoding=None, 
#                         preprocessor=None):
#     def get_template(self, uri):
#     def adjust_uri(self, uri, relativeto):
#     def filename_to_uri(self, filename):
#     def _relativeize(self, filename):
#     def _load(self, filename, uri):
#     def _check(self, uri, template):
#     def put_string(self, uri, text):
#     def put_template(self, uri, template):


from mako.template import Template
from mako import lookup
from util import flatten_result, result_lines
import unittest

class NamespaceTest(unittest.TestCase):
    def test_inline(self):
        t = Template("""
        <%namespace name="x">
            <%def name="a()">
                this is x a
            </%def>
            <%def name="b()">
                this is x b, and heres ${a()}
            </%def>
        </%namespace>
        
        ${x.a()}
        
        ${x.b()}
""")
        assert flatten_result(t.render()) == "this is x a this is x b, and heres this is x a"

    def test_template(self):

# Path: mako/lookup.py
# class TemplateCollection(object):
# class TemplateLookup(TemplateCollection):
#     def has_template(self, uri):
#     def get_template(self, uri, relativeto=None):
#     def filename_to_uri(self, uri, filename):
#     def adjust_uri(self, uri, filename):
#     def __init__(self, 
#                         directories=None, 
#                         module_directory=None, 
#                         filesystem_checks=True, 
#                         collection_size=-1, 
#                         format_exceptions=False, 
#                         error_handler=None, 
#                         disable_unicode=False, 
#                         output_encoding=None, 
#                         encoding_errors='strict', 
#                         cache_type=None, 
#                         cache_dir=None, cache_url=None,
#                         cache_enabled=True, 
#                         modulename_callable=None, 
#                         default_filters=None, 
#                         buffer_filters=(), 
#                         imports=None, 
#                         input_encoding=None, 
#                         preprocessor=None):
#     def get_template(self, uri):
#     def adjust_uri(self, uri, relativeto):
#     def filename_to_uri(self, filename):
#     def _relativeize(self, filename):
#     def _load(self, filename, uri):
#     def _check(self, uri, template):
#     def put_string(self, uri, text):
#     def put_template(self, uri, template):


# Path: test/test_namespace.py
from mako.template import Template
from mako import lookup
from util import flatten_result, result_lines
import unittest


class NamespaceTest(unittest.TestCase):
    def test_inline(self):
        t = Template("""
        <%namespace name="x">
            <%def name="a()">
                this is x a
            </%def>
            <%def name="b()">
                this is x b, and heres ${a()}
            </%def>
        </%namespace>
        
        ${x.a()}
        
        ${x.b()}
""")
        assert flatten_result(t.render()) == "this is x a this is x b, and heres this is x a"

    def test_template(self):

        collection = lookup.TemplateLookup()