Skip to content

Instantly share code, notes, and snippets.

@christinebuckler
Created August 10, 2018 03:57
Show Gist options
  • Save christinebuckler/5849f36657c95cd191874c74b095ed87 to your computer and use it in GitHub Desktop.
Save christinebuckler/5849f36657c95cd191874c74b095ed87 to your computer and use it in GitHub Desktop.
'''
To run test files, type the following into the terminal
py.test file.py –vv
'''
import unittest as unittest
from folder.file import MyClass
class TestMyClass(unittest.TestCase):
def test_myfunction(self):
myinstance = MyClass(someinput)
actual_output = myinstance.myfunction()
correct_output = value
self.assertAlmostEqual(actual_output, correct_output, \
msg='The actual output was {}, the correct output is {}.'.format(actual_output,correct_output))
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment