Skip to content

Commit

Permalink
handle type error in join
Browse files Browse the repository at this point in the history
  • Loading branch information
snopoke committed Jul 30, 2019
1 parent 31189e8 commit b824fdc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion commcare_export/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,10 @@ def count_selected(val):

def join(*args):
args = [unwrap_val(arg)for arg in args]
return args[0].join(args[1:])
try:
return args[0].join(args[1:])
except TypeError:
return '""'


@unwrap('val')
Expand Down
3 changes: 3 additions & 0 deletions tests/test_excel_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ def test_compile_mapped_field(self):
expression = compile_mapped_field({'a': 'mapped from a'}, Reference('foo.baz'))
assert list(expression.eval(env))[0].value == 'b'

expression = compile_mapped_field({'a': 'mapped from a'}, Reference('foo.boo'))
assert list(expression.eval(env)) == []

def test_get_queries_from_excel(self):
minilinq = Bind('checkpoint_manager', Apply(Reference('get_checkpoint_manager'), Literal(["Forms"])),
Emit(
Expand Down

0 comments on commit b824fdc

Please sign in to comment.