Procházet zdrojové kódy

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

benedikt-bartscher před 1 rokem
rodič
revize
9ce4e85050
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  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):