appunittest1.py 894 B

123456789101112131415161718192021222324252627282930
  1. # File Name: appunittest1.py
  2. # Date: April 15, 2017
  3. # Description: This class is for testing write file and read file in app.py
  4. # Method Level Comment: Python Convention (inside function)
  5. __author__ = "Inyoung Choung"
  6. from os import path
  7. import unittest
  8. from implementation import Impl
  9. # testing file IO.
  10. class writefiletest(unittest.TestCase):
  11. def runTest(self):
  12. """
  13. run Test to check if the file exists.
  14. :return:
  15. """
  16. # set a specific path to filepath variable
  17. filepath = "C:\In-young Choung\Computer Programming\Self Programming Files\grocerycalc\pytest.txt"
  18. # create a file and write "pythontest"
  19. Impl.writefile(self, filepath, "pythontest")
  20. # check if the file is correctly created in the path
  21. self.assertTrue(path.exists("pytest.txt"))
  22. # class starter
  23. if __name__ == '__main__':
  24. unittest.main()