Skip to main content

A simple test case runner in Python that uses TOML configurations and decorator syntax.

Project description

pysvt

About

A simple test case runner in Python that takes data in the format of a TOML file or dictionary and uses decorator syntax.

Installation

pip install pysvt

Upgrade version

pip install --upgrade pysvt

Usage

Check the examples directory for more elaborate examples.

  • Function

    Python

    from pysvt import test
    
    @test(file="<path_to_TOML_file>")
    def function(arg1: int, arg2: int) -> int:
        return arg1 + arg2
    

    TOML

    name = ["One and Two", "Two and Three"]
    metadata = ["Add to 3", "Add to 5"]
    i = [[1, 2], [2, 3]]
    o = [3, 5]
    

    or

    [[cases]]
    name = "One and Two"
    i = [1, 2]
    o = 3
    metadata = "Add to 3"
    
    [[cases]]
    name = "Two and Three"
    i = [2, 3]
    o = 5
    metadata = "Add to 5"
    
    • Input key can be either of - i, in, input, inputs
    • Output key can be either of - o, out, output, outputs
  • Class (if you want to test instance methods)

    Python

    from pysvt import test
    
    # Specify the name of the method as the second argument
    @test(file="<path_to_TOML_file>", "function")
    class Solution:
        def function(self, arg1: int, arg2: int) -> int:
            return arg1 + arg2
    

    TOML

    name = ["One and Two", "Two and Three"]
    metadata = ["Add to 3", "Add to 5"]
    init = []  # Has to be specified, indicates class constructor arguments
    i = [[1, 2], [2, 3]]
    o = [3, 5]
    

    or

    [[cases]]
    name = "One and Two"
    i = [1, 2]
    o = 3
    metadata = "Add to 3"
    init = []  # Has to be specified, indicates class constructor arguments
    
    [[cases]]
    name = "Two and Three"
    i = [2, 3]
    o = 5
    metadata = "Add to 5"
    init = []
    
    • Input key can be either of - i, in, input, inputs
    • Output key can be either of - o, out, output, outputs

Running examples

poetry run python -m examples.<example_file_name>

Creating a new release

  • Update the version in pyproject.toml
  • Update CHANGELOG.md
  • Run local lint/format/tests
  • Create new git tag and push

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

pysvt-0.6.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

pysvt-0.6.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file pysvt-0.6.0.tar.gz.

File metadata

  • Download URL: pysvt-0.6.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.2 Windows/11

File hashes

Hashes for pysvt-0.6.0.tar.gz
Algorithm Hash digest
SHA256 56733fa5001e4f8b63779a30430c2fe667b39ee1feba25c674deb265bc867435
MD5 6b4b45d81ebed69421cc39b97ef87ddf
BLAKE2b-256 7c47bf85fced0d9f94cf2ed197a04898623b477142e8d2ae96cfba207b69a422

See more details on using hashes here.

File details

Details for the file pysvt-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: pysvt-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.2 Windows/11

File hashes

Hashes for pysvt-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0fec01cdefb314eebf70ef081d8895ee2c5d085327dede22e24a7d3625276b4
MD5 a4a5e5bc8e9600a52bf4c0d3caa8dbbd
BLAKE2b-256 f47862b22d2d6a24158115453efbbb556541a92b0cb2595b996ca7a45df2e8c2

See more details on using hashes here.

Supported by

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