Skip to main content

generate unit tests for python code

Project description

template unit test case generator for python in golang style

VScode extension: https://github.com/RomanMIzulin/python_unittest_vscode

Can be found in vscode by unittest_generator or just via direct link https://marketplace.visualstudio.com/items?itemName=RomanMatveev.unittest-generator

TODO:

  • support pytest
  • support methods
  • write more tests
  • far future: autoimport neccesary types for tests
  • write FAQ and create simple github page

now it geneates for python function:

def kek(arg1: int, arg2: str) -> str:
    return str(arg1) + arg2

source code like this:

    def test_kek():
        @dataclass
        class Args:
            arg1: int
            arg2: str


        @dataclass
        class Test:
            name: str
            args: Args
            want: str

        cases: tuple[Test] = (
            # TODO: add cases here
        )
        for case in cases:
            if (v := func(*case.args)) != case.want:
                print(f"{func.__name__()} got {v} wanted {case.want}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_unit_generator-0.0.4.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_unit_generator-0.0.4-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file python_unit_generator-0.0.4.tar.gz.

File metadata

  • Download URL: python_unit_generator-0.0.4.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for python_unit_generator-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a2dd72b1a87fffbb8fce417987d106f642736e9e052fa77d1ed6d47f3564df8e
MD5 b7715aae6030f71a7258891e7c72c63f
BLAKE2b-256 4006a93c06edd8660e7da881b0c96853ab573c7249c599fd22473b1489f9b260

See more details on using hashes here.

File details

Details for the file python_unit_generator-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for python_unit_generator-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d854a9c7aa404f9a20d8f3b20f3d9405966eb2aeb8c74525e903a088b0c12bab
MD5 b0700ad117007e86e849c99bff26e9a5
BLAKE2b-256 24d23bf92d7e6a0f5a5e51b0b0822cad3c288e653b61cede0cf1617aa2173de5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page