Python2017/labs02/test_task.py

22 lines
433 B
Python
Raw Normal View History

2017-11-19 11:34:44 +01:00
#!/usr/bin/env python3
2017-11-18 00:19:40 +01:00
# -*- coding: utf-8 -*-
def suma(a, b):
"""
Napisz funkcję, która zwraca sumę elementów.
"""
2017-11-19 14:52:25 +01:00
return a + b
2017-11-18 00:19:40 +01:00
def tests(f):
inputs = [(2, 3), (0, 0), (1, 1)]
outputs = [5, 0, 2]
for input, output in zip(inputs, outputs):
2017-11-18 16:45:28 +01:00
if f(*input) != output:
return "ERROR: {}!={}".format(f(*input), output)
2017-11-18 00:19:40 +01:00
break
return "TESTS PASSED"
2017-11-19 14:52:25 +01:00
print(tests(suma))