summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-12-26 18:36:46 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-12-26 18:36:46 -0500
commit207f3a2e871f85cc0df88fb4ca92573bec33f4ab (patch)
tree01d40054831cfc35ed1b3fb25018c331ac1d62f8
parent523f77ec6f9673d06b9b189a2d51f208ce802b8f (diff)
downloadmako-207f3a2e871f85cc0df88fb4ca92573bec33f4ab.tar.gz
- remove creation of blank "x" file
-rw-r--r--test/test_template.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/test/test_template.py b/test/test_template.py
index 28db06d..6c30c8a 100644
--- a/test/test_template.py
+++ b/test/test_template.py
@@ -13,6 +13,16 @@ from test import TemplateTest, eq_, template_base, module_base, \
requires_python_26_or_greater, assert_raises, assert_raises_message, \
requires_python_2
+class ctx(object):
+ def __init__(self, a, b):
+ pass
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *arg):
+ pass
+
class EncodingTest(TemplateTest):
def test_escapes_html_tags(self):
from mako.exceptions import html_error_template
@@ -875,11 +885,12 @@ class ControlTest(TemplateTest):
def test_blank_control_8(self):
self._do_memory_test(
"""
- % with open('x', 'w') as fp:
+ % with ctx('x', 'w') as fp:
% endwith
""",
"",
- filters=lambda s:s.strip()
+ filters=lambda s: s.strip(),
+ template_args={"ctx": ctx}
)
def test_commented_blank_control_1(self):
@@ -973,12 +984,13 @@ class ControlTest(TemplateTest):
def test_commented_blank_control_8(self):
self._do_memory_test(
"""
- % with open('x', 'w') as fp:
+ % with ctx('x', 'w') as fp:
## comment
% endwith
""",
"",
- filters=lambda s:s.strip()
+ filters=lambda s: s.strip(),
+ template_args={"ctx": ctx}
)
def test_multiline_control(self):