From 9ce4e8505021c5da36acafb3f4600c24c1c9cf8d Mon Sep 17 00:00:00 2001 From: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com> Date: Fri, 2 Feb 2024 18:35:44 +0100 Subject: [PATCH] fix appharness regex for functions with return type (#2512) --- reflex/testing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reflex/testing.py b/reflex/testing.py index 6c2e4d884..9b9ea1c06 100644 --- a/reflex/testing.py +++ b/reflex/testing.py @@ -189,7 +189,9 @@ class AppHarness: if isinstance(app_source, str): return app_source source = inspect.getsource(app_source) - source = re.sub(r"^\s*def\s+\w+\s*\(.*?\):", "", source, flags=re.DOTALL) + source = re.sub( + r"^\s*def\s+\w+\s*\(.*?\)(\s+->\s+\w+)?:", "", source, flags=re.DOTALL + ) return textwrap.dedent(source) def _initialize_app(self):