From b824fdc6bef7736a6a4fcd255c2ad10f37016cf6 Mon Sep 17 00:00:00 2001 From: Simon Kelly Date: Tue, 30 Jul 2019 13:29:48 +0200 Subject: [PATCH] handle type error in join --- commcare_export/env.py | 5 ++++- tests/test_excel_query.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/commcare_export/env.py b/commcare_export/env.py index b885a696..df2567a4 100644 --- a/commcare_export/env.py +++ b/commcare_export/env.py @@ -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') diff --git a/tests/test_excel_query.py b/tests/test_excel_query.py index 3176ef89..60104859 100644 --- a/tests/test_excel_query.py +++ b/tests/test_excel_query.py @@ -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(