Ejemplo n.º 1
0
    def test_close_unsaved(self):
        self.view = new_view(self.window, content="Hello, World!")

        self.assertRaises(ValueError, close_view, self.view)
        self.assertTrue(self.view.is_valid())

        close_view(self.view, force=True)
        self.assertFalse(self.view.is_valid())
Ejemplo n.º 2
0
    def test_close_unsaved_clone(self):
        self.view = new_view(self.window, content="Hello, World!")

        clone = _clone_view(self.view)
        close_view(clone, force=True)

        self.assertFalse(clone.is_valid())
        self.assertTrue(self.view.is_valid())
        self.assertFalse(self.view.is_scratch())
Ejemplo n.º 3
0
    def test_close_closed_error(self):
        self.view = new_view(self.window)

        close_view(self.view)
        self.assertRaises(ValueError, close_view, self.view)
Ejemplo n.º 4
0
    def test_close_view(self):
        self.view = new_view(self.window)

        close_view(self.view)
        self.assertFalse(self.view.is_valid())
Ejemplo n.º 5
0
 def tearDown(self):
     if getattr(self, 'view', None):
         try:
             close_view(self.view, force=True)
         except ValueError:
             pass