Skip to main content

It makes combinations covering pairs for pairwise testing.

Project description

https://badge.fury.io/py/covertable.svg https://circleci.com/gh/walkframe/covertable.svg?style=shield https://codecov.io/gh/walkframe/covertable/branch/master/graph/badge.svg

Requirements

  • Python: 3.3 or later.

    • Tested with 3.7

Installation

$ pip install covertable

Usage

Just import covertable and call make function.

>>> from covertable import make, sorters

>>> machine_list = ['iphone', 'pixel']
>>> os_list = ['ios', 'android']
>>> browser_list = ['FireFox', 'Chrome', 'Safari']

>>> # list input and output
... make(
...     [machine_list, os_list, browser_list],  # list factors
...     length=2,  # default: 2
...     sorter=sorters.greedy,  # default: sorters.sequential
...     sort_kwargs={'seed': 100},  # default: {}
...     pre_filter=lambda row: not(row[1] == 'android' and row[0] != 'pixel'),  # default: None
...     post_filter=lambda row: not(row[1] == 'ios' and row[2] != 'Safari'),  # default: None
... )
[
  ['iphone', 'ios', 'Safari'],
  ['pixel', 'android', 'Safari']
]

>>> # dict input and output
... make(
...     {'machine': machine_list, 'os': os_list, 'browser': browser_list},  # dict factors
...     length=2,  # default: 2
...     sorter=sorters.greedy,  # default: sorters.sequential
...     sort_kwargs={'seed': 100},  # default: {}
...     pre_filter=lambda row: not(row['os'] == 'android' and row['machine'] != 'pixel'),  # default: None
...     post_filter=lambda row: not(row['os'] == 'ios' and row['browser'] != 'Safari'),  # default: None
... )
[
  {'os': 'ios', 'browser': 'Safari', 'machine': 'iphone'},
  {'machine': 'pixel', 'browser': 'Safari', 'os': 'android'}
]

Options

covertable.make function has options as keyword argument.

All options are omittable.

length

It means length of pair to meet. (default: 2)

The more it increases, the more number of combinations increases.

sorter

Combinations depend on the order of spreading all over the rows.

You can choice a sorter from the following:

sorters.sequential:

It is simplest and fastest sorter. (default)

sorters.random:

It makes different combinations everytime.

sorters.hash:

It makes combinations depending on hash of the pair (and seed).

sorters.greedy:

It attempts to make most efficient combinations, but slowest. (Warning: these combinations are not always shortest compared to the other sorter’s one.)

sort_kwargs

sort_kwargs will be passed to sorter function mentioned above.

seed:

It is a seed of hash. sorters.hash and sorters.greedy use this option.

When seed and factors are not changed, output combinations will not be changed.

Not relevant options will be ignored.

pre_filter

This means a function to filter beforehand.

It receives an argument row as object type.

When the function returns false, the row combination will not registered.

  • If factors type is Array, you should an index at the subscript like row => row[1] < 6.

  • IF factors type is Object, you should a key at the subscript like row => row.month < 6 or row => row[‘month’] < 6

post_filter

This means a function to filter later.

Usage is the same as preFilter, only the difference is the timing that it is called. It will delete rows not matched this function at the last.

Development

# preparation
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip install -r dev_requirements.txt

# testing
(venv) $ tox # -e py37 -e cov -e black

Publish

(venv) $ python setup.py sdist bdist_wheel
(venv) $ twine upload --repository pypi dist/*

History

1.0.x:
  • First release 🎉

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

covertable-1.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

covertable-1.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file covertable-1.0.0.tar.gz.

File metadata

  • Download URL: covertable-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for covertable-1.0.0.tar.gz
Algorithm Hash digest
SHA256 72c26a6534af07ddee1686a3d74a066f45eb0243a163cf9644b4e6f5b4512e45
MD5 46708982f04efcb008799d603f85f084
BLAKE2b-256 ef077413850625e01dcae0c6459d93d20579b027e372b83b57e006f0a8486aea

See more details on using hashes here.

File details

Details for the file covertable-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: covertable-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for covertable-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d44e443acd4ca1327033dba69afc7ea2cda6ba6c64ec0e02752424fe0730ac9
MD5 79351c498653643606eadbb6556b7682
BLAKE2b-256 69ec8c65ec9919bbcfca313ecd0c5cb48dfa5ae17907a02f64aed838c5fed44a

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