appunittest3.py 902 B

12345678910111213141516171819202122232425262728293031
  1. # File Name: appunittest3.py
  2. # Modified Date: March 26, 2017
  3. # Description: This class is to test sorting function.
  4. # Method Level Comment: Python Convention (inside function)
  5. __author__ = "Inyoung Choung"
  6. import unittest
  7. from implementation import Impl
  8. # testing sorting function.
  9. class testSort(unittest.TestCase):
  10. def runTest(self):
  11. """
  12. run Test to see if the expected array is equal to the sorted list.
  13. :return:
  14. """
  15. # list of Strings
  16. list = ['inyoung', 'banana', 'camera']
  17. # calls sort function and pass the list in the parameter.
  18. result = Impl.sort(self, list)
  19. # expected result after sorting.
  20. expected = ['banana', 'camera', 'inyoung']
  21. # check if the two values in the parameter are matched.
  22. self.assertEqual(result, expected)
  23. # class starter
  24. if __name__ == '__main__':
  25. unittest.main()