Je commence à apprendre le TDD. Je viens de commencer avec un test unitaire de python. Lorsque je tente d'exécuter:Python unitest ne fonctionne pas
[email protected]:~/pruebaTestPython$ python test_python_daily_software.py
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
J'ai lu dans d'autres links que je dois renommer mes propres fonctions avec test_
au début. Cependant, c'est exactement ce que j'ai fait, mais ça ne marche toujours pas.
fichier test_python_daily_software.py:
#!/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()
et fichier python_daily.py:
#!/usr/bin/python
# -*- coding: utf-8 -*-
def get_string(number):
return 'Hello'
ce qui est faux?
Erreur typique pour tout ce qui vient de C++. Je suis aveugle. Merci beaucoup – Maverick94