|
@ -1,6 +1,9 @@ |
|
|
|
|
|
# coding: utf-8 |
|
|
import unittest |
|
|
import unittest |
|
|
|
|
|
import numbers |
|
|
from fib import fib |
|
|
from fib import fib |
|
|
import logging |
|
|
import logging |
|
|
|
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
logging.basicConfig( format='%(asctime)-15s [%(levelname)s] %(funcName)s: %(message)s', level=logging.DEBUG) |
|
|
logging.basicConfig( format='%(asctime)-15s [%(levelname)s] %(funcName)s: %(message)s', level=logging.DEBUG) |
|
|
|
|
|
|
|
@ -41,5 +44,16 @@ class TestFib(unittest.TestCase): |
|
|
with self.assertRaises(ValueError): |
|
|
with self.assertRaises(ValueError): |
|
|
self.divide(1,0) |
|
|
self.divide(1,0) |
|
|
|
|
|
|
|
|
|
|
|
def test_excel(self): |
|
|
|
|
|
data = pd.read_excel('./Fib-Testdaten.xlsx') |
|
|
|
|
|
results = data["Ergebnis"] |
|
|
|
|
|
|
|
|
|
|
|
for key, result in data.items(): |
|
|
|
|
|
if isinstance(key, numbers.Number): #Überspringen der Überschriftenzeile |
|
|
|
|
|
self.assertEqual(result, fib(int(key))) |
|
|
|
|
|
|
|
|
|
|
|
print(f'Testdatentyp: ${type(data)}') |
|
|
|
|
|
print(f'Testdaten ${results}') |
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
unittest.main() |
|
|
unittest.main() |
|
|