Chatgpt Test Generator
Easy-to-use test generation tool. Powered by ChatGPT.
Project Structure:
├── main.py
├── poetry.lock
├── pyproject.toml
├── settings.toml
└── tests
Usage:
Generates automatic test for all functions with #GPT -> syntax.
Available syntax rules will increase in next releases.
main.py
import chatgpt_test_generator
# GPT ->
def search(array: list, number: int):
for idx, element in enumerate(array):
if element == number:
return idx
return -1
if __name__ == "__main__":
chatgpt_test_generator.generate_tests_on_background()
In addition, the settings.toml file should be configured as follows:
settings.toml
[default]
CHATGPT_API_KEY = "YOUR OPEN-AI API KEY"
If main.py is run, it will create tests for functions with GPT -> syntax under /test folder.
├── main.py
├── poetry.lock
├── pyproject.toml
├── settings.toml
└── tests
└── test_main.py
test_main.py
from main import search
def test_search():
array = [1, 2, 3, 4, 5]
assert search(array, 3) == 2
assert search(array, 6) == -1
It doesn't matter how complex the project folder is.
├── comlex_folder1
│ ├── complex_folder2
│ └── complex_folder4
│ └── example.py
│ └── complex_folder_3
├── main.py
├── poetry.lock
├── pyproject.toml
├── settings.toml
└── tests
└── test_main.py
example.py
# GPT ->
def divide_numbers(number1: int, number2: int):
return number1 / number2
If I run main.py again, the output will be like this.
├── comlex_folder1
│ ├── complex_folder2
│ │ └── complex_folder4
│ │ └── example.py
│ └── complex_folder_3
├── main.py
├── poetry.lock
├── pyproject.toml
├── settings.toml
└── tests
├── test_example.py
└── test_main.py
test_example.py
from comlex_folder1.complex_folder2.complex_folder4.example import divide_numbers
def test_divide_numbers():
assert divide_numbers(4, 2) == 2
assert divide_numbers(9, 3) == 3
assert divide_numbers(2, 4) == 0.5
assert divide_numbers(-4, -2) == 2
assert divide_numbers(-9, 3) == -3
assert divide_numbers(-2, 4) == -0.5
Metadata
Release files for chatgpt-test-generator 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chatgpt_test_generator-0.1.2.tar.gz | 5.1 kB | Without provenance | Details for chatgpt_test_generator-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chatgpt_test_generator-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for chatgpt_test_generator-0.1.2-py3-none-any.whl |
Total release size: 11.3 kB
Release files / chatgpt_test_generator-0.1.2.tar.gz
| Download URL | chatgpt_test_generator-0.1.2.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f9059e0495d8af08b0c56929600a862318410b67bfc583de0b165830922f4a6
|
|
BLAKE2b-256 checksum How to use checksums |
622662fc9cab56a2232bc95231f40d5986fb397dec1bdee26e2d0066a1956211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.8.10 Linux/5.19.0-35-generic
|
Release files / chatgpt_test_generator-0.1.2-py3-none-any.whl
| Download URL | chatgpt_test_generator-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
daddc84ae0305d5a9a2bdf52035b74a72e687c9da1f00c0077c645f86f6fc3ec
|
|
BLAKE2b-256 checksum How to use checksums |
57cbbbfdb3a2debaf289351bff277a1b4817ec45065f2448751719b9df567701
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.8.10 Linux/5.19.0-35-generic
|
Security for chatgpt-test-generator 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.