-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_program.py
142 lines (127 loc) · 5.16 KB
/
test_program.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import pytest
from largest_num import largest
from radius import radius
from gcd import gcd
from lcd import lcd
from number_type import prime
from next_prime import nex_prime
from previous_prime import previous_prime
from word_reverse import string_reverse
from palindrome import palindrome
from list_sum import sums
from list_larg import largest_list
from list_odd_even import find
from list_fist_last import first_last_element
@pytest.mark.parametrize("input_1, input_2, input_3, exact_output",
[
(5, 2, 3, 5),
(1, 10, 7, 10),
(9, 5, 3, 9)
]
)
def test_largest(input_1,input_2,input_3,exact_output):
assert largest(input_1,input_2,input_3) == exact_output
@pytest.mark.parametrize("input_1,exact_output",
[
(25, 2.82),
(28, 2.99),
(30, 3.09),
(35, 3.34),
(50, 3.99)
]
)
def test_radius(input_1,exact_output):
assert radius(input_1) == exact_output
@pytest.mark.parametrize("input_1,input_2,exact_output",
[
(8, 16, 8),
(24, 16, 8),
(33, 33, 33)
]
)
def test_gcd(input_1,input_2,exact_output):
assert gcd(input_1, input_2) == exact_output
@pytest.mark.parametrize("input_1,input_2,exact_output",
[
(65, 10, 130),
(50, 11, 550),
(7, 7, 7)
]
)
def test_lcd(input_1,input_2,exact_output):
assert lcd(input_1, input_2) == exact_output
@pytest.mark.parametrize("input_1,exact_output",
[
(2, True),
(3, True),
(4, False)
]
)
def test_prime(input_1,exact_output):
assert prime(input_1) == exact_output
@pytest.mark.parametrize("input_1,exact_output",
[
(2, 3),
(11, 13),
(14, 17)
]
)
def test_nex_prime(input_1,exact_output):
assert nex_prime(input_1) == exact_output
@pytest.mark.parametrize("input_1,exact_output",
[
(0, None),
(3, 2),
(4, 3),
(10, 9)
]
)
def test_previous_prime(input_1,exact_output):
assert previous_prime(input_1) == exact_output
@pytest.mark.parametrize("input_1,exact_output",
[
("Pradeep loves swetha", "swetha loves Pradeep"),
("but she don't know's it", "it know's don't she but"),
("pradeep loves pallavi", "pallavi loves pradeep"),
("but she love another fellow", "fellow another love she but")
]
)
def test_string_reverse(input_1,exact_output):
assert string_reverse(input_1) == exact_output
@pytest.mark.parametrize("input_1,exact_output",
[
("mom", True),
("DAD", True),
("bad", False),
("NUN", True),
]
)
def test_palindrome(input_1,exact_output):
assert palindrome(input_1)==exact_output
@pytest.mark.parametrize("input_1,exact_output",
[
([0,1,2,3,4,5,6,7,8,9,10], (30,25)),
([3,1,10,2,8,5,7,9,6,4,0], (30,25)),
([25,23,22,40], (62,48))
]
)
def test_sums(input_1,exact_output):
assert sums(input_1) == exact_output
@pytest.mark.parametrize("input_1,exact_output",
[
([0,1,2,3,4,5,6,7,8,9,10], [1,3,5,7,9,0,2,4,6,8,10]),
([3,1,10,2,8,5,7,9,6,4,0], [3,1,5,7,9,10,2,8,6,4,0]),
([25,23,22,40], [25,23,22,40])
]
)
def test_find(input_1,exact_output):
assert find(input_1) == exact_output
@pytest.mark.parametrize("input_1,exact_output",
[
([0,1,2,3,4,5,6,7,8,9,10], (0,10)),
([3,1,10,2,8,5,7,9,6,4,0], (0,10)),
([25,23,22,40], (22,40))
]
)
def test_first_last_element(input_1,exact_output):
assert first_last_element(input_1) == exact_output