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.3.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.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_unit_generator-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 851fd6db478e0945077abdd6983acc8bf543eee5d7c8bf40f1c235ce3c1859a0
MD5 601f66c57937ec1554581769ad95e840
BLAKE2b-256 ecd3ef8ca81e783730a1af9f2d8526029fcaa64641a60e4ec54e782c9748ef98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_unit_generator-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3c51503189c109a697a4dd6d3f1249526195a71e78aa7a0812578d2a2c28e078
MD5 786569994f1284068331def43173650d
BLAKE2b-256 056e1daee7a41bb4f7b67d72c951f2ee502e35d9545be0bf2842dac683dcaf8a

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