def test_update(): """Test update node attributes.""" u = Node('u', color='red') assert u['color'] == 'red' u.update(color='green', shape='rectangle') assert u['color'] == 'green' assert u['shape'] == 'rectangle'
def create_nodes_attributes(pathpy=True, number=5): """ Create Nodes with attributes. """ attr = {str(a): a for a in range(number)} if pathpy: a = Node('a', **attr) else: a = {} a.update(uid='a', attributes={}) a['attributes'].update(**attr) return True