def run_application(self): AppSettings.load_settings() VocableManager.load_vocables() self.xld_main_window = XLDMainWindow() Gtk.main()
def test_xml_settings_file_invariance(self): xml_settings_file_path = get_full_path('res/settings', 'settings.xml') settings_file_content_1 = None with open(xml_settings_file_path, 'rb') as settings_file: settings_file_content_1 = settings_file.read() AppSettings.load_settings() settings_1 = AppSettings.settings AppSettings.save_settings() settings_file_content_2 = None with open(xml_settings_file_path, 'rb') as settings_file: settings_file_content_2 = settings_file.read() AppSettings.load_settings() settings_2 = AppSettings.settings # equality does not work, since dictionaries do not have an invariant order of access, # but something weaker might work # assert settings_file_content_1 == settings_file_content_2, \ # 'Loading and saving the settings causes changes in the XML settings file, ' \ # 'although the settings didn\'t change. These changes might be whitespace character differences.' assert len(settings_file_content_1) == len(settings_file_content_2), \ 'The settings file contents differ in length.' for character in settings_file_content_1: assert character in settings_file_content_2, \ 'There is content in one settings file, which is not in the other.' for character in settings_file_content_2: assert character in settings_file_content_1, \ 'There is content in one settings file, which is not in the other.' characters_1 = {} for character in settings_file_content_1: if character in characters_1: characters_1[character] += 1 else: characters_1[character] = 1 characters_2 = {} for character in settings_file_content_2: if character in characters_2: characters_2[character] += 1 else: characters_2[character] = 1 assert characters_1 == characters_2, \ 'The settings files do not contain the same characters.' assert settings_1 == settings_2, \ 'Loading and saving the settings causes changes in the settings, ' \ 'although were not intentionally changed.'
def create_vocable_list(self): AppSettings.load_settings() list_of_vocables = [] for index in range(10): vocable_not_in_list = self.create_random_vocable() while any( item for item in list_of_vocables if item.first_language_translations == vocable_not_in_list.first_language_translations ): vocable_not_in_list = self.create_random_vocable() list_of_vocables.append(vocable_not_in_list) return list_of_vocables
def load_settings(self): AppSettings.load_settings()
def load_app_settings(self): print('loading app settings ...') AppSettings.load_settings() # TODO: use test settings
def create_xld_main_window(self): AppSettings.load_settings() # TODO: use test settings VocableManager.load_vocables() # TODO: use text vocables self.xld_main_window = XLDMainWindow() self.xld_main_window.show_all() GTKGUITestHelper.refresh_gui()