def run_application(self): AppSettings.load_settings() VocableManager.load_vocables() self.xld_main_window = XLDMainWindow() Gtk.main()
def test_vocable_list_invariance(self): # get vocables vocables = VocableManager.vocables # save vocables VocableManager.save_vocables(vocables) # check if the vocables are still the same VocableManager.load_vocables() new_vocables = VocableManager.vocables # test object inequality, to assure further testing this way is useful assert vocables[0] is not new_vocables[0], \ 'The compared vocable objects are identical.' # for all vocables for index in range(len(vocables)): # for all first language translations for attribute_index in range(len(vocables[index].first_language_translations)): first_language_transaltion_1 = vocables[index].first_language_translations[attribute_index] first_language_transaltion_2 = new_vocables[index].first_language_translations[attribute_index] assert first_language_transaltion_1 == first_language_transaltion_2, \ 'There are differences in a vocable\'s first_language_translations attribute.' # for all first language phonetic scripts for attribute_index in range(len(vocables[index].first_language_phonetic_scripts)): first_language_phonetic_script_1 = vocables[index].first_language_phonetic_scripts[attribute_index] first_language_phonetic_script_2 = new_vocables[index].first_language_phonetic_scripts[attribute_index] assert first_language_phonetic_script_1 == first_language_phonetic_script_2, \ 'There are differences in a vocable\'s first_language_phonetic_scripts attribute.' # for all second language translations for attribute_index in range(len(vocables[index].second_language_translations)): second_language_transaltion_1 = vocables[index].second_language_translations[attribute_index] second_language_transaltion_2 = new_vocables[index].second_language_translations[attribute_index] assert second_language_transaltion_1 == second_language_transaltion_2, \ 'There are differences in a vocable\'s second_language_translations attribute.' # for all second language phonetic scripts for attribute_index in range(len(vocables[index].second_language_phonetic_scripts)): second_language_phonetic_script_1 = vocables[index].second_language_phonetic_scripts[attribute_index] second_language_phonetic_script_2 = new_vocables[index].second_language_phonetic_scripts[attribute_index] assert second_language_phonetic_script_1 == second_language_phonetic_script_2, \ 'There are differences in a vocable\'s second_language_phonetic_scripts attribute.' # for all topics scripts for attribute_index in range(len(vocables[index].topics)): topic_1 = vocables[index].topics[attribute_index] topic_2 = new_vocables[index].topics[attribute_index] assert topic_1 == topic_2, \ 'There are differences in a vocable\'s topics attribute.' # for all chapters scripts for attribute_index in range(len(vocables[index].chapters)): chapter_1 = vocables[index].chapters[attribute_index] chapter_2 = new_vocables[index].chapters[attribute_index] assert chapter_1 == chapter_2, \ 'There are differences in a vocable\'s chapters attribute.' assert vocables[index].learn_level == new_vocables[index].learn_level, \ 'There are differences in a vocable\'s learn_level attribute.' assert vocables[index].relevance_level == new_vocables[index].relevance_level, \ 'There are differences in a vocable\'s relevance_level attribute.' assert vocables[index].description == new_vocables[index].description, \ 'There are differences in a vocable\'s description attribute.'
def load_vocables(self, load_app_settings): VocableManager.load_vocables() # TODO: use test vocables
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()
def test_vocable_list_invariance(self): # get vocables vocables = VocableManager.vocables # save vocables VocableManager.save_vocables(vocables) # check if the vocables are still the same VocableManager.load_vocables() new_vocables = VocableManager.vocables # test object inequality, to assure further testing this way is useful assert vocables[0] is not new_vocables[0], \ 'The compared vocable objects are identical.' # for all vocables for index in range(len(vocables)): # for all first language translations for attribute_index in range( len(vocables[index].first_language_translations)): first_language_transaltion_1 = vocables[ index].first_language_translations[attribute_index] first_language_transaltion_2 = new_vocables[ index].first_language_translations[attribute_index] assert first_language_transaltion_1 == first_language_transaltion_2, \ 'There are differences in a vocable\'s first_language_translations attribute.' # for all first language phonetic scripts for attribute_index in range( len(vocables[index].first_language_phonetic_scripts)): first_language_phonetic_script_1 = vocables[ index].first_language_phonetic_scripts[attribute_index] first_language_phonetic_script_2 = new_vocables[ index].first_language_phonetic_scripts[attribute_index] assert first_language_phonetic_script_1 == first_language_phonetic_script_2, \ 'There are differences in a vocable\'s first_language_phonetic_scripts attribute.' # for all second language translations for attribute_index in range( len(vocables[index].second_language_translations)): second_language_transaltion_1 = vocables[ index].second_language_translations[attribute_index] second_language_transaltion_2 = new_vocables[ index].second_language_translations[attribute_index] assert second_language_transaltion_1 == second_language_transaltion_2, \ 'There are differences in a vocable\'s second_language_translations attribute.' # for all second language phonetic scripts for attribute_index in range( len(vocables[index].second_language_phonetic_scripts)): second_language_phonetic_script_1 = vocables[ index].second_language_phonetic_scripts[attribute_index] second_language_phonetic_script_2 = new_vocables[ index].second_language_phonetic_scripts[attribute_index] assert second_language_phonetic_script_1 == second_language_phonetic_script_2, \ 'There are differences in a vocable\'s second_language_phonetic_scripts attribute.' # for all topics scripts for attribute_index in range(len(vocables[index].topics)): topic_1 = vocables[index].topics[attribute_index] topic_2 = new_vocables[index].topics[attribute_index] assert topic_1 == topic_2, \ 'There are differences in a vocable\'s topics attribute.' # for all chapters scripts for attribute_index in range(len(vocables[index].chapters)): chapter_1 = vocables[index].chapters[attribute_index] chapter_2 = new_vocables[index].chapters[attribute_index] assert chapter_1 == chapter_2, \ 'There are differences in a vocable\'s chapters attribute.' assert vocables[index].learn_level == new_vocables[index].learn_level, \ 'There are differences in a vocable\'s learn_level attribute.' assert vocables[index].relevance_level == new_vocables[index].relevance_level, \ 'There are differences in a vocable\'s relevance_level attribute.' assert vocables[index].description == new_vocables[index].description, \ 'There are differences in a vocable\'s description attribute.'