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())
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())
def test_close_closed_error(self): self.view = new_view(self.window) close_view(self.view) self.assertRaises(ValueError, close_view, self.view)
def test_close_view(self): self.view = new_view(self.window) close_view(self.view) self.assertFalse(self.view.is_valid())
def tearDown(self): if getattr(self, 'view', None): try: close_view(self.view, force=True) except ValueError: pass