From d11334e91de4f6d54af5aa0f56a6c269348dac92 Mon Sep 17 00:00:00 2001 From: Yusuke Oda Date: Fri, 17 Nov 2023 15:44:19 +0900 Subject: [PATCH] fix (#194) --- src/latexify/codegen/expression_codegen.py | 2 +- src/latexify/codegen/expression_codegen_test.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/latexify/codegen/expression_codegen.py b/src/latexify/codegen/expression_codegen.py index 3c72219..c400dac 100644 --- a/src/latexify/codegen/expression_codegen.py +++ b/src/latexify/codegen/expression_codegen.py @@ -105,7 +105,7 @@ def _generate_sum_prod(self, node: ast.Call) -> str | None: Returns: Generated LaTeX, or None if the node has unsupported syntax. """ - if not isinstance(node.args[0], ast.GeneratorExp): + if not node.args or not isinstance(node.args[0], ast.GeneratorExp): return None name = ast_utils.extract_function_name_or_none(node) diff --git a/src/latexify/codegen/expression_codegen_test.py b/src/latexify/codegen/expression_codegen_test.py index 5eb999b..41510fa 100644 --- a/src/latexify/codegen/expression_codegen_test.py +++ b/src/latexify/codegen/expression_codegen_test.py @@ -221,6 +221,8 @@ def test_visit_call(code: str, latex: str) -> None: @pytest.mark.parametrize( "src_suffix,dest_suffix", [ + # No arguments + ("()", r" \mathopen{}\left( \mathclose{}\right)"), # No comprehension ("(x)", r" x"), (