test_excel() implementiert.
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| @@ -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() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user