Преглед изворни кода

fix appharness regex for functions with return type (#2512)

benedikt-bartscher пре 1 година
родитељ
комит
9ce4e85050
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      reflex/testing.py

+ 3 - 1
reflex/testing.py

@@ -189,7 +189,9 @@ class AppHarness:
         if isinstance(app_source, str):
         if isinstance(app_source, str):
             return app_source
             return app_source
         source = inspect.getsource(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)
         return textwrap.dedent(source)
 
 
     def _initialize_app(self):
     def _initialize_app(self):