🧪4️⃣ test: level 4 gpt fix

This commit is contained in:
Florian Hönicke
2023-05-03 00:01:02 +02:00
parent 0fdf5edd2c
commit 412c0a9403
9 changed files with 122 additions and 57 deletions

View File

View File

@@ -20,7 +20,7 @@ def test_generation_level_0(tmpdir):
os.environ['VERBOSE'] = 'true'
generator = Generator(
"The microservice is very simple, it does not take anything as input and only outputs the word 'test'",
str(tmpdir) + 'microservice',
str(tmpdir),
'gpt-3.5-turbo'
)
assert generator.generate() == 0
@@ -44,7 +44,7 @@ def test_generation_level_1(tmpdir):
Example tweet:
\'When your coworker microwaves fish in the break room... AGAIN. 🐟🤢
But hey, at least SOMEONE's enjoying their lunch. #officelife\'''',
str(tmpdir) + 'microservice',
str(tmpdir),
'gpt-3.5-turbo'
)
assert generator.generate() == 0
@@ -63,7 +63,7 @@ def test_generation_level_2(tmpdir):
os.environ['VERBOSE'] = 'true'
generator = Generator(
"The input is a PDF like https://www.africau.edu/images/default/sample.pdf and the output the summarized text (50 words).",
str(tmpdir) + 'microservice',
str(tmpdir),
'gpt-3.5-turbo'
)
assert generator.generate() == 0
@@ -123,7 +123,7 @@ print('This is the text from the audio file:', response.json()['text'])
4. Return the the audio file as base64 encoded binary.
Example input file: https://www.signalogic.com/melp/EngSamples/Orig/ENG_M.wav
''',
str(tmpdir) + 'microservice',
str(tmpdir),
'gpt-4'
)
assert generator.generate() == 0
@@ -163,7 +163,7 @@ The joke is the put on the image.
The output is the image with the joke on it.
Example input image: https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/560px-PNG_transparency_demonstration_1.png
''',
str(tmpdir) + 'microservice',
str(tmpdir),
'gpt-3.5-turbo'
)
assert generator.generate() == 0

View File

@@ -1,15 +0,0 @@
from src.apis.jina_cloud import is_executor_in_hub
from src.apis.pypi import is_package_on_pypi
def test_is_microservice_in_hub():
assert is_executor_in_hub('reoihoflsnvoiawejeruhvflsfk') is False
assert is_executor_in_hub('CLIPImageEncoder') is True
def test_is_package_on_pypi():
assert is_package_on_pypi('jina') is True
assert is_package_on_pypi('jina', '0.9.25') is True
assert is_package_on_pypi('jina', '10.10.10') is False
assert is_package_on_pypi('jina-jina-jina') is False
assert is_package_on_pypi('jina-jina-jina', '0.9.25') is False
assert is_package_on_pypi('jina-jina-jina', '10.10.10') is False

0
test/unit/__init__.py Normal file
View File

34
test/unit/test_api.py Normal file
View File

@@ -0,0 +1,34 @@
from src.apis.jina_cloud import is_executor_in_hub
from src.apis.pypi import is_package_on_pypi
from src.options.generate.generator import Generator
def test_is_microservice_in_hub():
assert is_executor_in_hub('reoihoflsnvoiawejeruhvflsfk') is False
assert is_executor_in_hub('CLIPImageEncoder') is True
def test_is_package_on_pypi():
assert is_package_on_pypi('jina') is True
assert is_package_on_pypi('jina', '0.9.25') is True
assert is_package_on_pypi('jina', '10.10.10') is False
assert is_package_on_pypi('jina-jina-jina') is False
assert is_package_on_pypi('jina-jina-jina', '0.9.25') is False
assert is_package_on_pypi('jina-jina-jina', '10.10.10') is False
def test_filter_packages_list():
filtered_list = Generator.filter_packages_list([
["gpt_3_5_turbo", "requests", "base64", "gtts", "pydub"],
["requests", "base64", "gtts", "pydub"],
["gpt_3_5_turbo", "requests", "base64", "gtts"],
["gpt_3_5_turbo", "requests", "base64", "pydub"],
["requests", "base64", "gtts"]
])
assert filtered_list == [
["gpt_3_5_turbo", "requests", "gtts", "pydub"],
["requests", "gtts", "pydub"],
["gpt_3_5_turbo", "requests", "gtts"],
["gpt_3_5_turbo", "requests", "pydub"],
["requests", "gtts"]
]