0

I'm trying to test my code with unit tests, but when I try to run it it just says

Finding files... done.
Importing test modules ... done.
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK

Why isn't it working?

from Graph import Graph
import unittest
class GraphTest:
 def setUp(self):
 self.graph = Graph()
 for i in range(5):
 self.graph.addNode(i,"Node"+i)
 self.graph.addEdge(1,5,"Edge1,5")
 self.graph.addEdge(5,1,"Edge5,1")
 self.graph.addEdge(3,2,"Edge3,2")
 def test_Connected(self):
 self.assertTrue(self.graph.isConnected(1,5))
 self.assertTrue(self.graph.isConnected(5,1))
 self.assertTrue(self.graph.isConnected(3,2))
 self.assertFalse(self.graph.isConnected(2,3))
 self.assertFalse(self.graph.isConnected(1,4))
if __name__ == '__main__':
 unittest.main()
salmanwahed
9,6878 gold badges38 silver badges56 bronze badges
asked Oct 3, 2014 at 0:35

1 Answer 1

3

You should make your GraphTest a subclass of unittest.TestCase

answered Oct 3, 2014 at 0:38
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.