'Test scene through modifying the scheme.'

def test_scene_with_scheme(self):

    test_scheme = scheme.Scheme()
    self.scene.set_scheme(test_scheme)
    node_items = []
    link_items = []
    self.scene.node_item_added.connect(node_items.append)
    self.scene.node_item_removed.connect(node_items.remove)
    self.scene.link_item_added.connect(link_items.append)
    self.scene.link_item_removed.connect(link_items.remove)
    (file_desc, disc_desc, bayes_desc) = self.widget_desc()
    file_node = scheme.SchemeNode(file_desc)
    disc_node = scheme.SchemeNode(disc_desc)
    bayes_node = scheme.SchemeNode(bayes_desc)
    nodes = [file_node, disc_node, bayes_node]
    test_scheme.add_node(file_node)
    test_scheme.add_node(disc_node)
    test_scheme.add_node(bayes_node)
    self.assertTrue((len(self.scene.node_items()) == 3))
    self.assertSequenceEqual(self.scene.node_items(), node_items)
    for (node, item) in zip(nodes, node_items):
        self.assertIs(item, self.scene.item_for_node(node))
    test_scheme.remove_node(bayes_node)
    self.assertTrue((len(self.scene.node_items()) == 2))
    self.assertSequenceEqual(self.scene.node_items(), node_items)
    test_scheme.add_node(bayes_node)
    self.assertTrue((len(self.scene.node_items()) == 3))
    self.assertSequenceEqual(self.scene.node_items(), node_items)
    link1 = test_scheme.new_link(file_node, 'Data', disc_node, 'Data')
    link2 = test_scheme.new_link(disc_node, 'Data', bayes_node, 'Data')
    self.assertTrue((len(self.scene.link_items()) == 2))
    self.assertSequenceEqual(self.scene.link_items(), link_items)
    test_scheme.remove_link(link1)
    test_scheme.remove_link(link2)
    self.assertTrue((len(self.scene.link_items()) == 0))
    self.assertSequenceEqual(self.scene.link_items(), link_items)
    test_scheme.add_link(link1)
    self.assertTrue((len(self.scene.link_items()) == 1))
    self.assertSequenceEqual(self.scene.link_items(), link_items)
    self.app.exec_()
