Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

refine tests

geekan339d9de5c773
diff --git a/tests/metagpt/utils/test_output_parser.py b/tests/metagpt/utils/test_output_parser.py
index afacc28ea..d4bc04d0a 100644
--- a/tests/metagpt/utils/test_output_parser.py
+++ b/tests/metagpt/utils/test_output_parser.py
@@ -119,95 +119,7 @@ def test_extract_struct(
case()
-if __name__ == "__main__":
- t_text = '''
-## Required Python third-party packages
-```python
-"""
-flask==1.1.2
-pygame==2.0.1
-"""
-```
-
-## Required Other language third-party packages
-```python
-"""
-No third-party packages required for other languages.
-"""
-```
-
-## Full API spec
-```python
-"""
-openapi: 3.0.0
-info:
- title: Web Snake Game API
- version: 1.0.0
-paths:
- /game:
- get:
- summary: Get the current game state
- responses:
- '200':
- description: A JSON object of the game state
- post:
- summary: Send a command to the game
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- command:
- type: string
- responses:
- '200':
- description: A JSON object of the updated game state
-"""
-```
-
-## Logic Analysis
-```python
-[
- ("app.py", "Main entry point for the Flask application. Handles HTTP requests and responses."),
- ("game.py", "Contains the Game and Snake classes. Handles the game logic."),
- ("static/js/script.js", "Handles user interactions and updates the game UI."),
- ("static/css/styles.css", "Defines the styles for the game UI."),
- ("templates/index.html", "The main page of the web application. Displays the game UI.")
-]
-```
-
-## Task list
-```python
-[
- "game.py",
- "app.py",
- "static/css/styles.css",
- "static/js/script.js",
- "templates/index.html"
-]
-```
-
-## Shared Knowledge
-```python
-"""
-'game.py' contains the Game and Snake classes which are responsible for the game logic. The Game class uses an instance of the Snake class.
-
-'app.py' is the main entry point for the Flask application. It creates an instance of the Game class and handles HTTP requests and responses.
-
-'static/js/script.js' is responsible for handling user interactions and updating the game UI based on the game state returned by 'app.py'.
-
-'static/css/styles.css' defines the styles for the game UI.
-
-'templates/index.html' is the main page of the web application. It displays the game UI and loads 'static/js/script.js' and 'static/css/styles.css'.
-"""
-```
-
-## Anything UNCLEAR
-We need clarification on how the high score should be stored. Should it persist across sessions (stored in a database or a file) or should it reset every time the game is restarted? Also, should the game speed increase as the snake grows, or should it remain constant throughout the game?
- '''
-
+def test_parse_with_markdown_mapping():
OUTPUT_MAPPING = {
"Original Requirements": (str, ...),
"Product Goals": (List[str], ...),
@@ -218,7 +130,7 @@ We need clarification on how the high score should be stored. Should it persist
"Requirement Pool": (List[Tuple[str, str]], ...),
"Anything UNCLEAR": (str, ...),
}
- t_text1 = """## Original Requirements:
+ t_text1 = """[CONTENT]## Original Requirements:
The user wants to create a web-based version of the game "Fly Bird".
@@ -286,7 +198,7 @@ The product should be a web-based version of the game "Fly Bird" that is engagin
## Anything UNCLEAR:
There are no unclear points.
- """
+[/CONTENT]"""
d = OutputParser.parse_data_with_mapping(t_text1, OUTPUT_MAPPING)
import json