Commit 222a4ddc authored by Robert Behling's avatar Robert Behling
Browse files


parent f7b3e8b4
import unittest # framework for testing
import pandas as pd
from src import astronaut_analysis # only works if calling the test from the root directory (cd) root directory is should be working directory
class TestCalculateAge(unittest.TestCase):
def test_return_type(self):
birth_date = pd.Timestamp('1950-01-01') # example data with correct type (set up of the test)
self.assertEqual(type(astronaut_analysis.calculate_age(birth_date)) ,int)
def test_arg_type(self):
birth_date = '1950-01-01' # example data with wrong data. set up which should fail
with self.assertRaises(TypeError):
### here we could test data types also for all other datatypes
# Main entry point
if __name__ == "__main__":
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment