Skip to content
Myr

unit test for dumping as utf-8 to a file

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alex Morega · committed by Alex Morega · parent 4cd6e9a · Browse files · 1 file+14 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−0 removed

  • other:+14 added−0 removed

1 file+14 added−0 removed

modified:jinja2/testsuite/api.py+14 added
7 unmodified lines
8 :copyright: (c) 2010 by the Jinja Team.9 :license: BSD, see LICENSE for more details.10"""11import unittest12import os13import tempfile14import shutil1516from jinja2.testsuite import JinjaTestCase1718from jinja2 import Environment, Undefined, DebugUndefined, \
150 unmodified lines
169 assert stream.buffered170 stream.disable_buffering()171 assert not stream.buffered172173 def test_dump_stream(self):174 tmp = tempfile.mkdtemp()175 try:176 tmpl = env.from_string(u"\u2713")177 stream = tmpl.stream()178 stream.dump(os.path.join(tmp, 'dump.txt'), 'utf-8')179 with open(os.path.join(tmp, 'dump.txt'), 'rb') as f:180 self.assertEqual(f.read(), b'\xe2\x9c\x93')181 finally:182 shutil.rmtree(tmp)183184185class UndefinedTestCase(JinjaTestCase):186187 def test_stopiteration_is_undefined(self):188 def test():
72 unmodified lines