-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_math_func.py
More file actions
34 lines (24 loc) · 843 Bytes
/
test_math_func.py
File metadata and controls
34 lines (24 loc) · 843 Bytes
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
import math_func
import pytest
import sys
def test_add():
assert math_func.add(7, 3) == 10
assert math_func.add(7) == 9
def test_multiply():
assert math_func.multiply(7, 3) == 21
assert math_func.multiply(7) == 14
def test_add_float():
result = math_func.add(10.5, 25.5)
assert result == 36
def test_add_strings():
result = math_func.add('Hello ', 'World')
assert result == 'Hello World'
assert type(result) is str
assert 'Heldo' not in result
print('--------------', math_func.add('Hello ', 'World'), '--------------')
def test_multiply_strings():
assert math_func.multiply('Hello ', 3) == 'Hello Hello Hello '
result = math_func.multiply('Hello ')
assert result == 'Hello Hello '
assert type(result) is str
assert 'Hello' in result