DEV Community

Cover image for testing python code
MWæ NZå
MWæ NZå

Posted on

testing python code

def test_user_names(first, last):
"""" a function that prompts for user names """

full_name = first + " " + last
return full_name.title()
Enter fullscreen mode Exit fullscreen mode

guys above is my basic python code which is supposed to prompt for user input, first and last names.

note*.. i have written my file name containing the function above with a test_names.py, i have also done the same for the code below

below is the (unittest) code i am using to test if my code behaves correctly.

""" a class to test my test_names.py code"""

import unittest

from test_file_names import user_names

class test_nomencreture(unittest.TestCase):

def test_namesakes(self):
    adder = user_names('john','pedro')
    self.assertEquals(adder, 'john pedro')
Enter fullscreen mode Exit fullscreen mode

unittest.main()

....but for some reason am getting an error ,the test is failing ,the test is not running ,


Ran 0 tests in 0.000s

NO TESTS RAN

Process finished with exit code 5

Empty suite

(i am a beginner forgive me if the error is too basic . i do not know what the empty suite means,your help will be much appreciated

Top comments (0)