Skip to main content

Simple extension to have parametrized unit tests.

Project description

This package allows to create parametrized unit-tests that work with the standard unittest package. A parametrized test case is automatically converted to multiple test cases. Since they are TestCase subclasses, they work with other test suites that recognize TestCases.

Examples:

import unittest
import paramunittest

@paramunittest.parametrized(
    ('1', '2'),
    #(4, 3),
    ('2', '3'),
    (('4', ), {'b': '5'}),
    ((), {'a': 5, 'b': 6}),
    {'a': 5, 'b': 6},
)
class TestFoo(paramunittest.ParametrizedTestCase):
    def setParameters(self, a, b):
        self.a = a
        self.b = b

    def testLess(self):
        self.assertLess(self.a, self.b)

@paramunittest.parametrized(
    ('1', '2'),
    #(4, 3),
    ('2', '3'),
    (('4', ), {'b': '5'}),
    ((), {'a': 5, 'b': 6}),
    {'a': 5, 'b': 6},
)
class TestBar(unittest.TestCase):
    def setParameters(self, a, b):
        self.a = a
        self.b = b

    def testLess(self):
        self.assertLess(self.a, self.b)

Project details


Download files

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

Source Distributions

ParamUnittest-0.1.zip (4.7 kB view details)

Uploaded Source

ParamUnittest-0.1.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file ParamUnittest-0.1.zip.

File metadata

  • Download URL: ParamUnittest-0.1.zip
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ParamUnittest-0.1.zip
Algorithm Hash digest
SHA256 e022ec7c7955090b1e93cebf2dcf38ce574c7f55c4d7f82dc6f3c9ee2fe75add
MD5 f841a786e044f3daf30d98e4a647834d
BLAKE2b-256 f11ff421cdbd86bc81709ff69f0cc8bc1fd4f8e7e60f2c8132d6fa33a75f70af

See more details on using hashes here.

File details

Details for the file ParamUnittest-0.1.tar.gz.

File metadata

  • Download URL: ParamUnittest-0.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ParamUnittest-0.1.tar.gz
Algorithm Hash digest
SHA256 6f28ba5e204778deaebf7f5f21b803d6668c0799e49e42285f8f55312caf0b7e
MD5 01d1bfd2222e8c55a21d5305c4bf50ed
BLAKE2b-256 d7ef1029e037b314f708f16bf73d445d167d186e861c9e90a02028df23aa0c63

See more details on using hashes here.

Supported by

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