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.2.zip (4.6 kB view details)

Uploaded Source

ParamUnittest-0.2.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file ParamUnittest-0.2.zip.

File metadata

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

File hashes

Hashes for ParamUnittest-0.2.zip
Algorithm Hash digest
SHA256 3986ff045ca77d43de48d931c04a067e2e084727a0fdf7f418fde217823d74cb
MD5 431e7e39409b2a2c2a403532dce13191
BLAKE2b-256 60b7b775b4ce23ca303c7a41ab9a3ed303ba85d10d89b41524daa07619073fc6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ParamUnittest-0.2.tar.gz
Algorithm Hash digest
SHA256 a14509549171465c3a444fa631cb7066787e05970777e6370fbb17cde148e74e
MD5 982731aa4c09b4a9c8e3d7668fa2186a
BLAKE2b-256 a8637b69e8db183bb3592295f6d086cbc46be9bdbe6fdfa0d9f924a682faa5ae

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