@@ -0,0 +1,1194 @@
+import gaphas%0Aimport pytest%0A%0Afrom gaphor.services.eventmanager import EventManager%0Afrom gaphor.UML import Diagram%0Afrom gaphor.UML.elementfactory import ElementFactory%0Afrom gaphor.UML.presentation import Presentation%0A%0A%0Aclass Example(Presentation, gaphas.Element):%0A    def unlink(self):%0A        self.test_unlinked = True%0A        super().unlink()%0A%0A%0A@pytest.fixture%0Adef element_factory():%0A    event_manager = EventManager()%0A    element_factory = ElementFactory()%0A    yield element_factory%0A    element_factory.shutdown()%0A    event_manager.shutdown()%0A%0A%0Adef test_canvas_is_set_up():%0A    diagram = Diagram(%22id%22, None)%0A%0A    assert diagram.canvas%0A%0A%0Adef test_canvas_is_saved():%0A    diagram = Diagram(%22id%22, None)%0A    saved_keys = %5B%5D%0A    diagram.save(lambda name, val: saved_keys.append(name))%0A%0A    assert %22canvas%22 in saved_keys%0A%0A%0Adef test_canvas_item_is_created(element_factory):%0A    diagram = element_factory.create(Diagram)%0A    example = diagram.create(Example)%0A%0A    assert example in diagram.canvas.get_all_items()%0A%0A%0Adef test_canvas_is_unlinked(element_factory):%0A    diagram = element_factory.create(Diagram)%0A    example = diagram.create(Example)%0A%0A    diagram.unlink()%0A%0A    assert example.test_unlinked%0A

Add some extra tests for Diagram