Beispiel #1
0
def test_hello_who_leo():
    assert hello_who('Leo') == 'Hello, Leo'
Beispiel #2
0
from functions import salary, hello_who

"""
Тесты через assert
"""

# assert 2 > 1
# assert 3 > 1
# assert 4 > 1
# assert 1 == 1
#
# # будет ошибка
# assert 1 > 90, 'Какой то текст при возникновении ошибки'
#
# print('Это не выполнится')

assert hello_who('Max') == 'Hello, Max', 'Hello who error'
assert hello_who('Leo') == 'Hello, Leo', 'Hello who error'

assert salary(2, 1) == 4, salary(2, 1)
assert salary(2, 2) == 8
Beispiel #3
0
def test_hello_who_other():
    assert hello_who('Leo') == 'Hello, Leo'
    assert hello_who('Other') == 'Hello, Other'
    assert hello_who('Kate') == 'Hello, Kate'
from functions import salary, hello_who

# 1. написать программу
# 2. отдельно проверить функцию
#print(hello_who('Max'))

# salary(2, 10) == 20
# print(salary(2, 10))

# С помощью if
if salary(2, 10) != 20:
    print('Failed')
if hello_who('Max') != 'Hello, Max':
    print('Failed')
if hello_who('Leo') != 'Hello, Leo':
    print('Failed')

print('Ok')
Beispiel #5
0
def test_hello_who_max():
    assert hello_who('Max') == 'Hello, Max'