'Test basic scene functionality.'

def test_scene(self):

    (file_desc, disc_desc, bayes_desc) = self.widget_desc()
    file_item = items.NodeItem(file_desc)
    disc_item = items.NodeItem(disc_desc)
    bayes_item = items.NodeItem(bayes_desc)
    file_item = self.scene.add_node_item(file_item)
    disc_item = self.scene.add_node_item(disc_item)
    bayes_item = self.scene.add_node_item(bayes_item)
    self.scene.remove_node_item(bayes_item)
    self.assertSequenceEqual(self.scene.node_items(), [file_item, disc_item])
    self.scene.add_node_item(bayes_item)
    self.assertSequenceEqual(self.scene.node_items(), [file_item, disc_item, bayes_item])
    with self.assertRaises(ValueError):
        self.scene.add_node_item(bayes_item)
    link1 = self.scene.new_link_item(file_item, 'Data', disc_item, 'Data')
    link2 = self.scene.new_link_item(disc_item, 'Data', bayes_item, 'Data')
    link1a = self.scene.add_link_item(link1)
    link2a = self.scene.add_link_item(link2)
    self.assertEqual(link1, link1a)
    self.assertEqual(link2, link2a)
    self.assertSequenceEqual(self.scene.link_items(), [link1, link2])
    self.scene.remove_link_item(link2)
    self.scene.remove_link_item(link1)
    self.assertSequenceEqual(self.scene.link_items(), [])
    self.assertTrue(((link1.sourceItem is None) and (link1.sinkItem is None)))
    self.assertTrue(((link2.sourceItem is None) and (link2.sinkItem is None)))
    self.assertSequenceEqual(file_item.outputAnchors(), [])
    self.assertSequenceEqual(disc_item.inputAnchors(), [])
    self.assertSequenceEqual(disc_item.outputAnchors(), [])
    self.assertSequenceEqual(bayes_item.outputAnchors(), [])
    link1 = self.scene.new_link_item(file_item, 'Data', disc_item, 'Data')
    link1 = self.scene.add_link_item(link1)
    self.assertSequenceEqual(self.scene.link_items(), [link1])
    self.assertTrue(file_item.outputAnchors())
    self.assertTrue(disc_item.inputAnchors())
    self.app.exec_()
