Prompt Details
Model
Chat - GPT-3.5 (gpt-3.5-turbo)
Token size
48 ($0.00010 / call)
Example input
[testing framework]: PyTest / unittest / etc.
def add_by_two(numbers):
return [num + 2 for num in numbers]
Example output
import pytest
def test_add_by_two_empty_list():
assert add_by_two([]) == []
def test_add_by_two_single_element():
assert add_by_two([1]) == [3]
def test_add_by_two_positive_numbers():
assert add_by_two([1, 2, 3, 4, 5]) == [3, 4, 5, 6, 7]
def test_add_by_two_negative_numbers():
assert add_by_two([-1, -2, -3, -4, -5]) == [1, 0, -1, -2, -3]
def test_add_by_two_mixed_numbers():
assert add_by_two([-1, 0, 1, 2, 3]) == [1, 2, 3, 4, 5]
def test_add_by_two_empty_string():
assert add_by_two([""]) == TypeError
def test_add_by_two_strings():
assert add_by_two(["Hello", "World"]) == TypeError
Or get it with Select10 Select prompts/mo — under $2 each
Learn moreBy purchasing this prompt, you agree to our terms of service
GPT-3.5-TURBO
Absolutely nobody wants to write unit tests. However, it does make your codebase more stable and assures that functionality of your code is tested.
Usage of this prompt is extremely easy! Just provide the piece of Python code that you want unit test for and they will be generated.
This prompt allows you to define the Python unit testing suite.
Certainly works with:
- PyTest
- unittest
Other frameworks that likely also work are:
- nose
- doctest
- tox
- Robot Framework
...more
Added over 1 month ago

