1

I have tried so many ways(Pycharm and unittest does not work ) to solve the problem.
But I am still a bit clueless on what is going on here.
I can't run basic unittests. Thank you in advance.

#test_names.py
import unittest
from Practices.SomeFunction import get_formatted_name
class NameTestCase(unittest.TestCase):  
    """test get_fotmatted_name()"""

    def test_first_last_name(self):
        formatted_name = get_formatted_name('janis', 'joplin')
        self.assertEqual(formatted_name, 'Janis Joplin')

unittest.main() 

result

list

2 Answers 2

1

just need to add

if __name__ == '__main__': 

then

if __name__ == '__main__': 
    unittest.main()
Sign up to request clarification or add additional context in comments.

Comments

0

In Pycharm it isn't necessary to add the line unittest.main() If you remove it, it should work fine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.