def test_mantid_api_import_needed(self): expected_results = [False, False, True, False, False, True, False, False, False] with mock.patch(PERMISSION_BOX_FUNC, lambda: True): for case, expected_out in zip(self.test_cases, expected_results): self.assertEqual(expected_out, mantid_api_import_needed(case), msg=self.gen_fail_msg(case, expected_out))
def open_file_in_new_tab(self, filepath, startup=False): """Open the existing file in a new tab in the editor :param filepath: A path to an existing file :param startup: Flag for if function is being called on startup """ with open(filepath, 'r') as code_file: content = code_file.read() self.append_new_editor(content=content, filename=filepath) if startup is False and mantid_api_import_needed(content) is True: add_mantid_api_import(self.current_editor().editor, content)
def open_file_in_new_tab(self, filepath, startup=False): """Open the existing file in a new tab in the editor :param filepath: A path to an existing file :param startup: Flag for if function is being called on startup """ with open(filepath, 'r') as code_file: content = code_file.read() self.append_new_editor(content=content, filename=filepath) if startup is False and mantid_api_import_needed(content) is True: add_mantid_api_import(self.current_editor().editor, content)