Browse Source

test_excel() implementiert.

develop
Olli Graf 2 years ago
parent
commit
3434ab2d9f
  1. BIN
      testing/__pycache__/fib.cpython-39.pyc
  2. 14
      testing/unittestfib.py

BIN
testing/__pycache__/fib.cpython-39.pyc

Binary file not shown.

14
testing/unittestfib.py

@ -1,6 +1,9 @@
# coding: utf-8
import unittest
import numbers
from fib import fib
import logging
import pandas as pd
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):
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__':
unittest.main()

Loading…
Cancel
Save