예제 #1
0
 def testWorks(self):
     """Test that it works as described."""
     d = {'a': 1, 'b': 2}
     d2 = utils.swap_keys_and_values(d)
     self.assertEqual(d2, {1: 'a', 2: 'b'})
예제 #2
0
파일: pagerank.py 프로젝트: sdouche/pynocle
 def __init__(self, dependencies):
     self.node_to_outgoing_map = self._create_node_to_outgoing(dependencies)
     self.node_to_id_map = self._create_node_to_id(self.node_to_outgoing_map.keys())
     self.id_to_node_map = utils.swap_keys_and_values(self.node_to_id_map)
예제 #3
0
 def testWorks(self):
     """Test that it works as described."""
     d = {'a':1, 'b':2}
     d2 = utils.swap_keys_and_values(d)
     self.assertEqual(d2, {1:'a', 2:'b'})
예제 #4
0
 def __init__(self, dependencies):
     self.node_to_outgoing_map = self._create_node_to_outgoing(dependencies)
     self.node_to_id_map = self._create_node_to_id(
         self.node_to_outgoing_map.keys())
     self.id_to_node_map = utils.swap_keys_and_values(self.node_to_id_map)