Skip to content

Commit

Permalink
Merge pull request #1148 from fishtown-analytics/feature/jinja-do-sta…
Browse files Browse the repository at this point in the history
…tement

Jinja expression statements (#1113)
  • Loading branch information
beckjake authored Nov 23, 2018
2 parents 029ef17 + 069bc3a commit f72e0a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dbt/clients/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def __call__(self, *args, **kwargs):

def get_environment(node=None, capture_macros=False):
args = {
'extensions': []
'extensions': ['jinja2.ext.do']
}

if capture_macros:
Expand Down
11 changes: 11 additions & 0 deletions test/unit/test_jinja.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import unittest

from dbt.clients.jinja import get_template

class TestJinja(unittest.TestCase):
def test_do(self):
s = '{% set my_dict = {} %}\n{% do my_dict.update(a=1) %}'

template = get_template(s, {})
mod = template.make_module()
self.assertEqual(mod.my_dict, {'a': 1})

0 comments on commit f72e0a8

Please sign in to comment.