-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleNodeTest.py
More file actions
38 lines (28 loc) · 921 Bytes
/
Copy pathSimpleNodeTest.py
File metadata and controls
38 lines (28 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'''
python3 -m pip install pytest
'''
import unittest
from SimpleNode import *
class SimpleNodeTest( unittest.TestCase ):
def setUp(self):
self.node = SimpleNode(2)
def testHasNext(self):
self.assertEqual( self.node.hasNext(), False )
self.node.setNext( SimpleNode(3) )
self.assertEqual( self.node.hasNext(), True )
def testHasNotNext(self):
self.assertEqual( self.node.hasNext(), False )
def testSetValue(self):
self.node.setValue(9)
self.assertEqual( self.node.getValue(), 9 )
def testGetValue(self):
self.assertEqual( self.node.getValue(), 2 )
def testNextNodeNone(self):
self.assertIsNone( self.node.getNext() )
def testNextNodeIsNotNone(self):
self.node.setNext( SimpleNode(7) )
self.assertIsNotNone( self.node.getNext() )
if __name__ == '__main__':
runner = unittest.TextTestRunner()
suite = unittest.loadTestsFromTestCase( SimplesNodeTest )
runnet.run( suite )