test-template-engine: deduplicate methods of custom template engine
authorYuya Nishihara <yuya@tcha.org>
Thu, 15 Mar 2018 20:10:54 +0900
changeset 36969 452696bf3e60
parent 36968 2090044a288d
child 36970 e55d80804ace
test-template-engine: deduplicate methods of custom template engine
tests/test-template-engine.t
--- a/tests/test-template-engine.t	Thu Jan 18 15:10:22 2018 +0100
+++ b/tests/test-template-engine.t	Thu Mar 15 20:10:54 2018 +0900
@@ -6,23 +6,12 @@
   >     templateutil,
   > )
   > 
-  > class mytemplater(object):
-  >     def __init__(self, loader, filters, defaults, resources, aliases):
-  >         self.loader = loader
-  >         self._defaults = defaults
-  >         self._resources = resources
-  > 
-  >     def symbol(self, mapping, key):
-  >         return mapping[key]
-  > 
-  >     def resource(self, mapping, key):
-  >         v = self._resources[key]
-  >         if v is None:
-  >             v = mapping[key]
-  >         return v
+  > class mytemplater(templater.engine):
+  >     def _load(self, t):
+  >         return self._loader(t)
   > 
   >     def process(self, t, map):
-  >         tmpl = self.loader(t)
+  >         tmpl = self._load(t)
   >         props = self._defaults.copy()
   >         props.update(map)
   >         for k, v in props.items():