Commit 00fcee67 authored by Robert Behling's avatar Robert Behling
Browse files

unit tests

parent eb2c5086
...@@ -12,7 +12,7 @@ Python:pylint: ...@@ -12,7 +12,7 @@ Python:pylint:
script: script:
- pipenv run pylint --rcfile test/linting/pylintrc src/*.py - pipenv run pylint --rcfile test/linting/pylintrc src/*.py
Python:unittests Python:unittests:
stage: test stage: test
script: script:
- pipenv run python -m unittest discover test/unittests - pipenv run python -m unittest discover test/unittests
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()
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