From 6b73726caf0146690e1803056187d8a584ad06cb Mon Sep 17 00:00:00 2001 From: odashi Date: Fri, 17 Nov 2023 04:43:35 +0000 Subject: [PATCH] fix --- 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"), (