def test_create_with_path(): path = "/temp/non-existent/project.edxt" assert not os.path.exists(path) result = Project.create_with_path(path) try: eq_(result.path, path) finally: result.close()
def iter_dropped_paths(self, pasteboard): from editxt.document import TextDocument if not pasteboard.types().containsObject_(ak.NSFilenamesPboardType): raise StopIteration() for path in pasteboard.propertyListForType_(ak.NSFilenamesPboardType): if Project.is_project_path(path): proj = self.app.find_project_with_path(path) if proj is None: proj = Project.create_with_path(path) yield proj else: yield TextDocument.get_with_path(path)
def do_load_project(path): import editxt.project as mod m = Mocker() create_document_view_with_state = m.method(Project.create_document_view_with_state) create_document_view_with_state(ANY) with m: proj = Project.create_with_path(path) try: assert proj.path == path assert len(proj.documents()) == 1 finally: proj.close()
def do_load_project(path): import editxt.project as mod m = Mocker() create_document_view_with_state = m.method( Project.create_document_view_with_state) create_document_view_with_state(ANY) with m: proj = Project.create_with_path(path) try: assert proj.path == path assert len(proj.documents()) == 1 finally: proj.close()