Cleaned up shitty syntax in testsuite
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parent cb4b551 · Browse files · 11 files·+29 added−29 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
11 files+29 added−29 removed
- tests:+29 added−29 removed
Provenance
- Commit
73e2b51- Tree
880a67e- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
cb4b551
11 files changed+29 added−29 removed
modified:tests/test_api.py+5 added-5 removed
21 unmodified lines22 23 24 @pytest.mark.api25 @pytest.mark.extended26-class TestExtendedAPI():26+class TestExtendedAPI(object):27 28 def test_item_and_attribute(self, env):29 from jinja2.sandbox import SandboxedEnvironment30 75 unmodified lines106 107 108 @pytest.mark.api109 @pytest.mark.meta110-class TestMeta():110+class TestMeta(object):111 112 def test_find_undeclared_variables(self, env):113 ast = env.parse('{% set foo = 42 %}{{ bar + foo }}')114 x = meta.find_undeclared_variables(ast)39 unmodified lines154 155 156 @pytest.mark.api157 @pytest.mark.streaming158-class TestStreaming():158+class TestStreaming(object):159 160 def test_basic_streaming(self, env):161 tmpl = env.from_string("<ul>{% for item in seq %}<li>{{ loop.index "162 "}} - {{ item }}</li>{%- endfor %}</ul>")35 unmodified lines198 199 200 @pytest.mark.api201 @pytest.mark.undefined202-class TestUndefined():202+class TestUndefined(object):203 204 def test_stopiteration_is_undefined(self):205 def test():206 raise StopIteration()101 unmodified lines308 309 310 @pytest.mark.api311 @pytest.mark.lowlevel312-class TestLowLevel():312+class TestLowLevel(object):313 314 def test_custom_code_generator(self):315 class CustomCodeGenerator(CodeGenerator):316 def visit_Const(self, node, frame=None):24 unmodified linesmodified:tests/test_bytecode_cache.py+1 added-1 removed
22 unmodified lines23 )24 25 26 @pytest.mark.byte_code_cache27-class TestByteCodeCache():27+class TestByteCodeCache(object):28 29 def test_simple(self, env):30 tmpl = env.get_template('test.html')31 assert tmpl.render().strip() == 'BAR'1 unmodified linemodified:tests/test_ext.py+4 added-4 removed
158 unmodified lines159 yield Token(lineno, 'data', token.value[pos:])160 161 162 @pytest.mark.ext163-class TestExtensions():163+class TestExtensions(object):164 165 def test_extend_late(self):166 env = Environment()167 env.add_extension('jinja2.ext.autoescape')77 unmodified lines245 assert ext[1].__class__ is T2246 247 248 @pytest.mark.ext249-class TestInternationalization():249+class TestInternationalization(object):250 251 def test_trans(self):252 tmpl = i18n_env.get_template('child.html')253 assert tmpl.render(LANGUAGE='de') == '<title>fehlend</title>pass auf'60 unmodified lines314 ]315 316 317 @pytest.mark.ext318-class TestNewstyleInternationalization():318+class TestNewstyleInternationalization(object):319 320 def test_trans(self):321 tmpl = newstyle_i18n_env.get_template('child.html')322 assert tmpl.render(LANGUAGE='de') == '<title>fehlend</title>pass auf'73 unmodified lines396 assert t.render() == '%(foo)s'397 398 399 @pytest.mark.ext400-class TestAutoEscape():400+class TestAutoEscape(object):401 402 def test_scoped_setting(self):403 env = Environment(extensions=['jinja2.ext.autoescape'],404 autoescape=True)71 unmodified linesmodified:tests/test_imports.py+2 added-2 removed
24 unmodified lines25 return env26 27 28 @pytest.mark.imports29-class TestImports():29+class TestImports(object):30 31 def test_context_imports(self, test_env):32 t = test_env.from_string('{% import "module" as m %}{{ m.test() }}')33 assert t.render(foo=42) == '[|23]'39 unmodified lines73 74 75 @pytest.mark.imports76 @pytest.mark.includes77-class TestIncludes():77+class TestIncludes(object):78 79 def test_context_include(self, test_env):80 t = test_env.from_string('{% include "header" %}')81 assert t.render(foo=42) == '[42|23]'75 unmodified linesmodified:tests/test_inheritance.py+2 added-2 removed
76 unmodified lines77 }), trim_blocks=True)78 79 80 @pytest.mark.inheritance81-class TestInheritance():81+class TestInheritance(object):82 83 def test_layout(self, env):84 tmpl = env.get_template('layout')85 assert tmpl.render() == ('|block 1 from layout|block 2 from '114 unmodified lines200 assert rv == ['43', '44', '45']201 202 203 @pytest.mark.inheritance204-class TestBugFix():204+class TestBugFix(object):205 206 def test_fixed_macro_scoping_bug(self, env):207 assert Environment(loader=DictLoader({208 'test.html': '''\40 unmodified linesmodified:tests/test_lexnparse.py+5 added-5 removed
25 unmodified lines26 27 28 @pytest.mark.lexnparse29 @pytest.mark.tokenstream30-class TestTokenStream():30+class TestTokenStream(object):31 test_tokens = [Token(1, TOKEN_BLOCK_BEGIN, ''),32 Token(2, TOKEN_BLOCK_END, ''),33 ]34 19 unmodified lines54 55 56 @pytest.mark.lexnparse57 @pytest.mark.lexer58-class TestLexer():58+class TestLexer(object):59 60 def test_raw1(self, env):61 tmpl = env.from_string(62 '{% raw %}foo{% endraw %}|'65 unmodified lines128 129 130 @pytest.mark.lexnparse131 @pytest.mark.parser132-class TestParser():132+class TestParser(object):133 134 def test_php_syntax(self, env):135 env = Environment('<?', '?>', '<?=', '?>', '<!--', '-->')136 tmpl = env.from_string('''\108 unmodified lines245 246 247 @pytest.mark.lexnparse248 @pytest.mark.syntax249-class TestSyntax():249+class TestSyntax(object):250 251 def test_call(self, env):252 env = Environment()253 env.globals['foo'] = lambda a, b, c, e, g: a + b + c + e + g187 unmodified lines441 442 443 @pytest.mark.lexnparse444 @pytest.mark.lstripblocks445-class TestLstripBlocks():445+class TestLstripBlocks(object):446 447 def test_lstrip(self, env):448 env = Environment(lstrip_blocks=True, trim_blocks=False)449 tmpl = env.from_string(''' {% if True %}\n {% endif %}''')164 unmodified linesmodified:tests/test_loader.py+2 added-2 removed
20 unmodified lines21 from jinja2.exceptions import TemplateNotFound22 23 24 @pytest.mark.loaders25-class TestLoaders():25+class TestLoaders(object):26 27 def test_dict_loader(self, dict_loader):28 env = Environment(loader=dict_loader)29 tmpl = env.get_template('justdict.html')90 unmodified lines120 121 122 @pytest.mark.loaders123 @pytest.mark.moduleloader124-class TestModuleLoader():124+class TestModuleLoader(object):125 archive = None126 127 def compile_down(self, prefix_loader, zip='deflated', py_compile=False):128 log = []106 unmodified linesmodified:tests/test_regression.py+2 added-2 removed
15 unmodified lines16 from jinja2._compat import text_type17 18 19 @pytest.mark.regression20-class TestCorner():20+class TestCorner(object):21 22 def test_assigned_scoping(self, env):23 t = env.from_string('''24 {%- for item in (1, 2, 3, 4) -%}52 unmodified lines77 assert t.render(wrapper=23) == '[1][2][3][4]23'78 79 80 @pytest.mark.regression81-class TestBug():81+class TestBug(object):82 83 def test_keyword_folding(self, env):84 env = Environment()85 env.filters['testing'] = lambda value, some: value + some252 unmodified linesmodified:tests/test_security.py+1 added-1 removed
40 unmodified lines41 return 'PublicStuff'42 43 44 @pytest.mark.sandbox45-class TestSandbox():45+class TestSandbox(object):46 47 def test_unsafe(self, env):48 env = SandboxedEnvironment()49 pytest.raises(SecurityError, env.from_string("{{ foo.foo() }}").render,141 unmodified linesmodified:tests/test_tests.py+1 added-1 removed
12 unmodified lines13 from jinja2 import Markup, Environment14 15 16 @pytest.mark.test_tests17-class TestTestsCase():17+class TestTestsCase(object):18 19 def test_defined(self, env):20 tmpl = env.from_string('{{ missing is defined }}|'21 '{{ true is defined }}')93 unmodified linesmodified:tests/test_utils.py+4 added-4 removed
17 unmodified lines18 19 20 @pytest.mark.utils21 @pytest.mark.lrucache22-class TestLRUCache():22+class TestLRUCache(object):23 24 def test_simple(self):25 d = LRUCache(3)26 d["a"] = 118 unmodified lines45 46 47 @pytest.mark.utils48 @pytest.mark.helpers49-class TestHelpers():49+class TestHelpers(object):50 51 def test_object_type_repr(self):52 class X(object):53 pass7 unmodified lines61 @pytest.mark.utils62 @pytest.mark.markupleak63 @pytest.mark.skipif(hasattr(escape, 'func_code'),64 reason='this test only tests the c extension')65-class TestMarkupLeak():65+class TestMarkupLeak(object):66 67 def test_markup_leaks(self):68 counts = set()69 for count in range(20):7 unmodified lines77 78 79 @pytest.mark.utils80 @pytest.mark.escapeUrlizeTarget81-class TestEscapeUrlizeTarget():81+class TestEscapeUrlizeTarget(object):82 def test_escape_urlize_target(self):83 url = "http://example.org"84 target = "<script>"85 assert urlize(url, target=target) == ('<a href="http://example.org"'2 unmodified lines