mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-24 09:04:19 +01:00
🧪4️⃣ test: level 3 fix no input
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
||||
id: test
|
||||
run: |
|
||||
pytest -vs test/test_generator.py::test_generation_level_${{ matrix.group }}
|
||||
timeout-minutes: 10
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
SCENEX_API_KEY: ${{ secrets.SCENEX_API_KEY }}
|
||||
|
||||
@@ -118,6 +118,10 @@ The function must full-fill: '{microservice_description}'.
|
||||
It will be tested with the following scenario: '{test_description}'.
|
||||
For the implementation use the following package(s): '{packages}'.
|
||||
|
||||
The code must start with the following import:
|
||||
```
|
||||
from .apis import GPT_3_5_Turbo_API
|
||||
```
|
||||
Obey the following rules:
|
||||
''' + not_allowed_function_string + '''
|
||||
|
||||
@@ -138,11 +142,10 @@ template_generate_test = PromptTemplate.from_template(
|
||||
Write a single pytest case that tests the following scenario: '{test_description}'. In case the test scenario is not precise enough, test a general case without any assumptions.
|
||||
Start the test with an extensive comment about the test case. If gpt_3_5_turbo_api is used in the executor, then the test must not check the exact output of the executor as it is not deterministic.
|
||||
|
||||
You must use the following import to import the function:
|
||||
The test must start with the following import:
|
||||
```
|
||||
from .implementation import func
|
||||
```
|
||||
|
||||
''' + not_allowed_function_string + '''
|
||||
The test must not open local files.
|
||||
The test must not mock a function of the executor.
|
||||
|
||||
@@ -68,13 +68,43 @@ def test_generation_level_2(tmpdir):
|
||||
)
|
||||
assert generator.generate() == 0
|
||||
|
||||
|
||||
def test_generation_level_3(tmpdir):
|
||||
"""
|
||||
Requirements:
|
||||
coding challenge: ❌
|
||||
pip packages: ✅ (text to speech)
|
||||
pip packages: ✅ (csv parser)
|
||||
environment: ❌
|
||||
GPT-3.5-turbo: ✅ (for processing the text)
|
||||
APIs: ✅ (financial data API)
|
||||
Databases: ❌
|
||||
"""
|
||||
os.environ['VERBOSE'] = 'true'
|
||||
generator = Generator(
|
||||
f'''The input is a stock symbol (e.g., AAPL for Apple Inc.).
|
||||
1. Fetch stock data (open, high, low, close, volume) for the past 30 days using a financial data API (e.g., Alpha Vantage, Yahoo Finance, or any other API).
|
||||
2. Calculate the average closing price over the 30 days.
|
||||
3. Read a CSV file containing a list of stock symbols and their company names.
|
||||
4. Find the input stock symbol in the CSV file and get the corresponding company name.
|
||||
5. Generate a brief summary of the company's stock performance over the past 30 days, including the average closing price and the company name.
|
||||
6. Return the summary as a string.
|
||||
Example input: 'AAPL'
|
||||
Example CSV file format:
|
||||
symbol,company_name
|
||||
AAPL,Apple Inc.
|
||||
GOOGL,Alphabet Inc.
|
||||
AMZN,Amazon.com, Inc.
|
||||
''',
|
||||
str(tmpdir) + 'microservice',
|
||||
'gpt-3.5-turbo'
|
||||
)
|
||||
assert generator.generate() == 0
|
||||
|
||||
def test_generation_level_4(tmpdir):
|
||||
"""
|
||||
Requirements:
|
||||
coding challenge: ❌
|
||||
pip packages: ✅ (text to speech)
|
||||
environment: ✅ (tts library)
|
||||
GPT-3.5-turbo: ✅ (summarizing the text)
|
||||
APIs: ✅ (whisper for speech to text)
|
||||
Databases: ❌
|
||||
@@ -101,17 +131,17 @@ print('This is the text from the audio file:', response.json()['text'])
|
||||
Example input file: https://www.signalogic.com/melp/EngSamples/Orig/ENG_M.wav
|
||||
''',
|
||||
str(tmpdir) + 'microservice',
|
||||
'gpt-3.5-turbo'
|
||||
'gpt-4'
|
||||
)
|
||||
assert generator.generate() == 0
|
||||
|
||||
|
||||
def test_generation_level_4(tmpdir):
|
||||
def test_generation_level_5(tmpdir):
|
||||
"""
|
||||
Requirements:
|
||||
coding challenge: ✅ (putting text on the image)
|
||||
pip packages: ✅ (Pillow for image processing)
|
||||
environment: ❌
|
||||
environment: ✅ (image library)
|
||||
GPT-3.5-turbo: ✅ (for writing the joke)
|
||||
APIs: ✅ (scenex for image description)
|
||||
Databases: ❌
|
||||
|
||||
Reference in New Issue
Block a user