コード例 #1
0
ファイル: test.py プロジェクト: pzeballos/python-bootcamp
    def test_method_has_key_of_Graph(self):
        """Test case:
        * check that node is a Node object
        * if the key is available in the dict, return True
        """
        g = Graph()
        with self.assertRaises(TypeError) as context:
            g.has_key('A')
        self.assertTrue('A is not of type Node' in context.exception)

        n1 = Node('A')
        g.addNode(n1)
        self.assertTrue(g.has_key(n1))