I'm beginning to learn TDD. I have just started with unit test from python. When I try to execute:
vagrant@vagrant:~/pruebaTestPython$ python test_python_daily_software.py
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
I have read in other links that I need to rename my own functions with test_
at the beginning. However, this is exactly what I did, but it still doesn't work.
test_python_daily_software.py file:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import python_daily
class TestPythonSoftware(unittest.TestCase):
def test_should_return_python_when_number_is_3(self):
self.assertEqual('Python', python_daily.get_string(3))
def test_should_return_daily_when_number_is_5(self):
self.assertEqual('Daily', python_daily.get_string(5))
if __name__ == '__main__':
unittest.main()
and python_daily.py file:
#!/usr/bin/python
# -*- coding: utf-8 -*-
def get_string(number):
return 'Hello'
what is wrong?