test_unittest_test_data_types.py 495 Bytes
Newer Older
Robert Behling's avatar
Robert Behling committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import unittest
import pandas as pd
from src import astronauts_analysis


class TestCalculateAge(unittest.TestCase):

    def test_return_type(self):
        birth_date = pd.Timestamp('1950-01-01')
        self.assertEqual(type(astronauts_analysis.calculate_age(birth_date)), int)

    def test_arg_type(self):
        birth_date = '1950-01-01'
        with self.assertRaises(TypeError):
            astronauts_analysis.calculate_age(birth_date)


if __name__ == '__main__':
    unittest.main()