Patchwork [1,of,3] test-template-engine: deduplicate methods of custom template engine

login
register
mail settings
Submitter Yuya Nishihara
Date March 16, 2018, 4:02 p.m.
Message ID <a305e7f025b030a74ca1.1521216171@mimosa>
Download mbox | patch
Permalink /patch/29563/
State Accepted
Headers show

Comments

Yuya Nishihara - March 16, 2018, 4:02 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1521112254 -32400
#      Thu Mar 15 20:10:54 2018 +0900
# Node ID a305e7f025b030a74ca178f722e7502d6c012d6a
# Parent  451f4ada3589ebf0074f0a882c5b6b03b2c70bdf
test-template-engine: deduplicate methods of custom template engine
Pulkit Goyal - March 17, 2018, 11:31 a.m.
On Fri, Mar 16, 2018 at 9:32 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1521112254 -32400
> #      Thu Mar 15 20:10:54 2018 +0900
> # Node ID a305e7f025b030a74ca178f722e7502d6c012d6a
> # Parent  451f4ada3589ebf0074f0a882c5b6b03b2c70bdf
> test-template-engine: deduplicate methods of custom template engine

Queued the series, many thanks!

Patch

diff --git a/tests/test-template-engine.t b/tests/test-template-engine.t
--- a/tests/test-template-engine.t
+++ b/tests/test-template-engine.t
@@ -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():