'Python (unittest) doesn't detect functions/classes to test

import unittest
from jump import get_formatted_name

class NamesTestCase(unittest.TestCase):
  """Test for the jump.py """
  def test_first_last_name(self):
    """test first and last name"""
    formatted_name = get_formatted_name('pallav','sinha')
    self.assertEqual(formatted_name, 'Pallav Sinha')

unittest.main()

I am getting this as a result


----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

I should get

.
--------------------------------------
Ran 1 test in 0.00s

What can I do to get this test function running?

JUMP

 def get_formatted_name(first,last):
  """Generate a formatted name"""
  full_name = first+ " " + last
  return full_name.title()

from main import get_formatted_name
print ( "Enter 'q' to quit this program")
while True:
  first = input("\nPlease enter your first name: ")
  if first == 'q':
   break

  last = input("\nPlease enter your last name:")
  if last == 'q':
    break

  formatted_name = get_formatted_name(first, last)
  print("\nYour name is " + formatted_name + ".")

This is the jump file from which I am importing the get_formatted_name



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source