Ejemplo n.º 1
0
class DictLoaderTestCase(unittest.TestCase):
    """Test the ``DictLoader``."""
    def setUp(self) -> None:
        self.loader = DictLoader(templates={
            "tmpl1.html": "x",
            "shared/master.html": "x"
        })

    def test_list_names(self) -> None:
        """Tests list_names."""
        assert ("shared/master.html", "tmpl1.html") == self.loader.list_names()

    def test_load_existing(self) -> None:
        """Tests load."""
        assert "x" == self.loader.load("tmpl1.html")

    def test_load_not_found(self) -> None:
        """Tests load if the name is not found."""
        assert self.loader.load("tmpl-x.html") is None
Ejemplo n.º 2
0
class DictLoaderTestCase(unittest.TestCase):
    """ Test the ``DictLoader``.
    """
    def setUp(self):
        from wheezy.template.loader import DictLoader
        self.loader = DictLoader(templates={
            'tmpl1.html': 'x',
            'shared/master.html': 'x'
        })

    def test_list_names(self):
        """ Tests list_names.
        """
        assert ('shared/master.html', 'tmpl1.html') == self.loader.list_names()

    def test_load_existing(self):
        """ Tests load.
        """
        assert 'x' == self.loader.load('tmpl1.html')

    def test_load_not_found(self):
        """ Tests load if the name is not found.
        """
        assert self.loader.load('tmpl-x.html') is None