Skip to content

Commit a942cbb

Browse files
committed
Add examples
1 parent a3beb1e commit a942cbb

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

examples/example_ordered_dict.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
4+
from __future__ import print_function
5+
6+
from collections import OrderedDict
7+
8+
from allpairspy import AllPairs
9+
10+
11+
parameters = OrderedDict({
12+
"brand": ["Brand X", "Brand Y"],
13+
"os": ["98", "NT", "2000", "XP"],
14+
"minute": [15, 30, 60],
15+
})
16+
17+
print("PAIRWISE:")
18+
for i, pairs in enumerate(AllPairs(parameters)):
19+
print("{:2d}: {}".format(i, pairs))

examples/test_parameterize.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
4+
"""
5+
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
6+
"""
7+
8+
from __future__ import print_function
9+
from __future__ import unicode_literals
10+
11+
import pytest
12+
13+
from allpairspy import AllPairs
14+
15+
16+
def function_to_be_tested(brand, operating_system, minute):
17+
# do something
18+
19+
return True
20+
21+
22+
class Test__parameterized(object):
23+
24+
@pytest.mark.parametrize(
25+
["brand", "operating_system", "minute"],
26+
[
27+
value_list for value_list in AllPairs([
28+
["Brand X", "Brand Y"],
29+
["98", "NT", "2000", "XP"],
30+
[10, 15, 30, 60]
31+
])
32+
])
33+
def test(self, brand, operating_system, minute):
34+
assert function_to_be_tested(brand, operating_system, minute)

0 commit comments

Comments
 (0)