1
|
|
|
from fastest.bodies.test_case_template_builder import case_generator |
2
|
|
|
from fastest.bodies.test_case_template_builder import create_assertion_test |
3
|
|
|
from fastest.bodies.test_case_template_builder import create_naive_test_case |
4
|
|
|
from fastest.bodies.test_case_template_builder import create_type_test_case |
5
|
|
|
from fastest.bodies.test_case_template_builder import create_type_test_case_if_params |
6
|
|
|
from fastest.bodies.test_case_template_builder import get_empty_of_type |
7
|
|
|
from fastest.bodies.test_case_template_builder import get_params_list |
8
|
|
|
from fastest.bodies.test_case_template_builder import is_type_test_ready |
9
|
|
|
from fastest.constants import TestBodies |
10
|
|
|
import unittest |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
class TestFCaseGenerator(unittest.TestCase): |
14
|
|
|
def test__case_generator__FEB45420EC(self): |
15
|
|
|
self.assertEqual(case_generator('a55eff11-ed51-ecb37-ccba'), 'A55EFF11ED') |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
class TestFGetEmptyOfType(unittest.TestCase): |
19
|
|
|
def test__get_empty_of_type__6AE4237E62(self): |
20
|
|
|
self.assertEqual(get_empty_of_type('str'), "''") |
21
|
|
|
|
22
|
|
|
def test__get_empty_of_type__F2B045FFA3(self): |
23
|
|
|
self.assertEqual(get_empty_of_type('???'), None) |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
class TestFGetParamsList(unittest.TestCase): |
27
|
|
|
def test__get_params_list__B1348ED47E(self): |
28
|
|
|
self.assertEqual(get_params_list(['str', 'str', 'list', 'dict']), ["''", "''", '[]', '{}']) |
29
|
|
|
|
30
|
|
|
def test__get_params_list__B2F225C40B(self): |
31
|
|
|
self.assertEqual(get_params_list(['str', '???']), ["''"]) |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
class TestFCreateTypeTestCase(unittest.TestCase): |
35
|
|
|
def test__create_type_test_case__78C8453D01(self): |
36
|
|
|
function_object = { |
37
|
|
|
'tests': { |
38
|
|
|
'return': 'str' |
39
|
|
|
}, |
40
|
|
|
'name': 'function_1' |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
params = ['str', 'str'] |
44
|
|
|
|
45
|
|
|
self.assertEqual(create_type_test_case(function_object, params), TestBodies.TYPE_TEST_CASE_1) |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
class TestFCreateTypeTestCaseIfParams(unittest.TestCase): |
49
|
|
|
def test__create_type_test_case_if_params__1A0BB272B8(self): |
50
|
|
|
function_object = { |
51
|
|
|
'tests': { |
52
|
|
|
'return': 'str' |
53
|
|
|
}, |
54
|
|
|
'name': 'function_1' |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
params = ['str', 'str'] |
58
|
|
|
|
59
|
|
|
self.assertEqual(create_type_test_case_if_params(function_object, params), TestBodies.TYPE_TEST_CASE_2) |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
class TestFIsTypeTestReady(unittest.TestCase): |
63
|
|
|
def test__is_type_test_ready__C2E9335266(self): |
64
|
|
|
function_object_1 = { |
65
|
|
|
'tests': { |
66
|
|
|
'return': 'str' |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
function_object_2 = {'tests': {}} |
71
|
|
|
|
72
|
|
|
params = ['str', 'str'] |
73
|
|
|
|
74
|
|
|
self.assertEqual(is_type_test_ready(function_object_1, params), True) |
75
|
|
|
|
76
|
|
|
def test__is_type_test_ready__6CF6127E76(self): |
77
|
|
|
function_object_1 = { |
78
|
|
|
'tests': { |
79
|
|
|
'return': 'str' |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
function_object_2 = {'tests': {}} |
84
|
|
|
|
85
|
|
|
params = ['str', 'str'] |
86
|
|
|
|
87
|
|
|
self.assertEqual(is_type_test_ready(function_object_2, params), False) |
88
|
|
|
|
89
|
|
|
def test__is_type_test_ready__9335004014(self): |
90
|
|
|
function_object_1 = { |
91
|
|
|
'tests': { |
92
|
|
|
'return': 'str' |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
function_object_2 = {'tests': {}} |
97
|
|
|
|
98
|
|
|
params = ['str', 'str'] |
99
|
|
|
|
100
|
|
|
self.assertEqual(is_type_test_ready(function_object_1, []), False) |
101
|
|
|
|
102
|
|
|
|
103
|
|
|
class TestFCreateAssertionTest(unittest.TestCase): |
104
|
|
|
def test__create_assertion_test__ACB551FFCF(self): |
105
|
|
|
function_object_1 = { |
106
|
|
|
'tests': { |
107
|
|
|
'variables': ['a = 5'] |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
function_object_2 = {'tests': {'variables': []}} |
112
|
|
|
|
113
|
|
|
params = ['str', 'str'] |
114
|
|
|
|
115
|
|
|
self.assertEqual(create_assertion_test(function_object_1), TestBodies.ASSERTION_TEST_1) |
116
|
|
|
|
117
|
|
|
def test__create_assertion_test__AE86DA16B8(self): |
118
|
|
|
function_object_1 = { |
119
|
|
|
'tests': { |
120
|
|
|
'variables': ['a = 5'] |
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
function_object_2 = {'tests': {'variables': []}} |
125
|
|
|
|
126
|
|
|
params = ['str', 'str'] |
127
|
|
|
|
128
|
|
|
self.assertEqual(create_assertion_test(function_object_2), '') |
129
|
|
|
|
130
|
|
|
|
131
|
|
|
class TestFCreateNaiveTestCase(unittest.TestCase): |
132
|
|
|
def test__create_naive_test_case__D5CE6058D6(self): |
133
|
|
|
function_object = { |
134
|
|
|
'tests': { |
135
|
|
|
'return': 'str', |
136
|
|
|
'variables': ['a = 5'] |
137
|
|
|
}, |
138
|
|
|
'name': 'function_1' |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
test = { |
142
|
|
|
'from': 'function_1', |
143
|
|
|
'expect': '2' |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
test_id = 'a55eff11-ed51-ecb37-ccba' |
147
|
|
|
|
148
|
|
|
self.assertEqual(create_naive_test_case(function_object, test, test_id), TestBodies.NAIVE_TEST_RESULT) |
149
|
|
|
|