Selaa lähdekoodia

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

benedikt-bartscher 1 vuosi sitten
vanhempi
säilyke
9ce4e85050
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      reflex/testing.py

+ 3 - 1
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):