Created
October 4, 2016 18:28
-
-
Save trekr5/215ea60bb65cde244884d8ca16a0988c to your computer and use it in GitHub Desktop.
Source python file and test python file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#test.py | |
class Test: | |
def __init__(self, members): | |
self.members = members | |
def printMembers(self): | |
print('Printing members of Test class...') | |
for member in self.members: print('\t%s ' % member) | |
test = Test(['Gazelle', 'Elephant', 'Lion', 'Fish']) | |
test.printMembers() | |
#test_test.py | |
import unittest | |
from test import Test | |
class TestTestCase(unittest.TestCase): | |
"""Tests for `test.py`.""" | |
#preparing to test | |
def setUp(self): | |
"""Sample test case""" | |
print "TestTest::setUp_:begin" | |
# self.members = [1, 2, 3, 4, 5] | |
self.members = Test([1, 2, 3, 4]) | |
def test_is_printMembers(self): | |
"""Will print a list of contents?""" | |
self.assertTrue(self.members.printMembers) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment