-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_lesson8_yaml_testbed.py
43 lines (34 loc) · 1.2 KB
/
test_lesson8_yaml_testbed.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#from testbed.yaml_testbed import init_testbed
from test_steps import ok, eq, ne, init_testbed, check
tb_m = init_testbed("/Users/xili4/PycharmProjects/TestSteps/test_examples/lesson8_testbed_obj.yaml")
def test_no_param():
ok(tb_m)
print(tb_m)
print(tb_m.obj1)
ok(tb_m.obj1)
ok(tb_m.obj1.ppp())
def test_with_param_in_func():
#tb_m = init_testbed("lesson8_testbed_obj.yaml")
eq(tb_m.obj1.ppp2(3,5), 8)
ne(tb_m.obj1.ppp2(100,20), 102)
eq(tb_m.obj1.ppp2(4,6,10), 20)
def test_with_param_in_class():
eq(tb_m.obj2.get_value(), 17)
eq(tb_m.obj2.multiple(10), 170)
eq(tb_m.obj2.get_value(), 170)
def test_with_paramoption_in_class():
eq(tb_m.obj3.get_msg(), 'Goodafternoon')
eq(tb_m.obj4.get_msg(), 'Goodqq')
def test_with_index_file():
eq(tb_m.obj5.get_value(), 22)
eq(tb_m.obj6.get_value(), 17)
eq(tb_m.obj6.get_msg(), 'Goodafternoon')
#eq(tb_m.obj6.multiple(10), 170)
check("tb_m.obj6.multiple(10) == 170")
check("tb_m.obj6.multiple(10) == 20", warning=True, repeat=2)
if __name__ == '__main__':
test_no_param()
test_with_param_in_func()
test_with_param_in_class()
test_with_paramoption_in_class()
test_with_index_file()