Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- tests/test_myco_core.py +15 -0
- ui/gradio_app.py +1 -8
tests/test_myco_core.py
CHANGED
|
@@ -101,6 +101,21 @@ class MycoCoreTests(unittest.TestCase):
|
|
| 101 |
self.assertNotIn("return (", source)
|
| 102 |
self.assertNotIn("[", source)
|
| 103 |
self.assertNotIn("]", source)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
def test_gradio_app_avoids_fragile_multiline_return_tuples(self):
|
| 105 |
source = Path("ui/gradio_app.py").read_text()
|
| 106 |
self.assertNotIn("return (", source)
|
|
|
|
| 101 |
self.assertNotIn("return (", source)
|
| 102 |
self.assertNotIn("[", source)
|
| 103 |
self.assertNotIn("]", source)
|
| 104 |
+
|
| 105 |
+
def test_gradio_app_rejects_old_corrupted_callback_fragments(self):
|
| 106 |
+
source = Path("ui/gradio_app.py").read_text()
|
| 107 |
+
forbidden_fragments = (
|
| 108 |
+
"def ask_myco(",
|
| 109 |
+
"def add_to_dex(",
|
| 110 |
+
"def study_mushroom(",
|
| 111 |
+
"def begin_forest_search(",
|
| 112 |
+
"def explore(",
|
| 113 |
+
"explore_button",
|
| 114 |
+
"outputs=[",
|
| 115 |
+
"def build_app() ->",
|
| 116 |
+
)
|
| 117 |
+
for fragment in forbidden_fragments:
|
| 118 |
+
self.assertNotIn(fragment, source)
|
| 119 |
def test_gradio_app_avoids_fragile_multiline_return_tuples(self):
|
| 120 |
source = Path("ui/gradio_app.py").read_text()
|
| 121 |
self.assertNotIn("return (", source)
|
ui/gradio_app.py
CHANGED
|
@@ -1,10 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
"""Gradio app composition for Myco."""
|
| 3 |
-
"""Gradio app composition for Myco.
|
| 4 |
-
|
| 5 |
-
Callbacks intentionally avoid complex type annotations because Hugging Face Spaces
|
| 6 |
-
was serving an older broken annotated version of this file.
|
| 7 |
-
"""
|
| 8 |
|
| 9 |
import gradio as gr
|
| 10 |
|
|
@@ -66,7 +60,6 @@ def search_forest(collection):
|
|
| 66 |
return (
|
| 67 |
forest_scene(current, collection),
|
| 68 |
game_status_markdown(current, collection),
|
| 69 |
-
from __future__ import annotations
|
| 70 |
|
| 71 |
import gradio as gr
|
| 72 |
|
|
|
|
| 1 |
+
# Gradio app composition for Myco.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
|
|
|
|
| 60 |
return (
|
| 61 |
forest_scene(current, collection),
|
| 62 |
game_status_markdown(current, collection),
|
|
|
|
| 63 |
|
| 64 |
import gradio as gr
|
| 65 |
|