class ChainLoaderTestCase(unittest.TestCase): """ Test the ``ChainLoader``. """ def setUp(self): from wheezy.template.loader import ChainLoader from wheezy.template.loader import DictLoader self.loader = ChainLoader(loaders=[ DictLoader(templates={ 'tmpl1.html': 'x1', }), DictLoader(templates={'shared/master.html': 'x2'}) ]) 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 'x1' == self.loader.load('tmpl1.html') assert 'x2' == self.loader.load('shared/master.html') def test_load_missing(self): """ Tests load not found. """ assert not self.loader.load('missing')
class ChainLoaderTestCase(unittest.TestCase): """Test the ``ChainLoader``.""" def setUp(self) -> None: self.loader = ChainLoader(loaders=[ DictLoader(templates={ "tmpl1.html": "x1", }), DictLoader(templates={"shared/master.html": "x2"}), ]) 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 "x1" == self.loader.load("tmpl1.html") assert "x2" == self.loader.load("shared/master.html") def test_load_missing(self) -> None: """Tests load not found.""" assert not self.loader.load("missing")