def test_ConfigLoader_set_up_frame_PctSpinBox_no_error_with_int(self):
        # Default: 'error_probability' = 0.02
        ed = ErrorDetails()

        save_config({'error_probability': 10})
        loader = ConfigLoader()
        loader.set_up_frame(ed)
        self.assertEqual(ed.get_values()['error_probability'], 0.10)
    def test_ConfigLoader_set_up_frame_ParagraphType(self):
        pt = ParagraphType()
        loader = ConfigLoader()
        loader.set_up_frame(pt)
        answer = {
            'paragraph_type': 'chain',
            'subject_pool': 5,
            'num_paragraphs': 4,
            'paragraph_size': 15
        }

        self.assertEqual(pt.get_values(), answer)
    def test_ConfigLoader_set_up_frame_GrammarDetails(self):
        gd = GrammarDetails()
        loader = ConfigLoader()
        loader.set_up_frame(gd)
        answer = {
            'tense': 'simple_present',
            'probability_plural_noun': 0.3,
            'probability_negative_verb': 0.3,
            'probability_pronoun': 0.2
        }

        self.assertEqual(gd.get_values(), answer)
    def test_WARNING_ConfigLoader_set_up_frame_int_and_pct_edge_case_with_bool_WARNING(
            self):
        # 'subject_pool' minimum = 2
        # 'error_probability' minimum = 0.0
        pt = ParagraphType()
        ed = ErrorDetails()

        save_config({'subject_pool': True, 'error_probability': True})
        loader = ConfigLoader()
        loader.set_up_frame(pt)
        loader.set_up_frame(ed)
        self.assertEqual(pt.get_values()['subject_pool'], 2)
        self.assertEqual(ed.get_values()['error_probability'], 0.0)
    def test_ConfigLoader_set_up_frame_bool_no_error_with_int(self):
        # Default: 'verb_errors' = True
        ed = ErrorDetails()

        save_config({'verb_errors': 0})
        loader = ConfigLoader()
        loader.set_up_frame(ed)
        self.assertEqual(ed.get_values()['verb_errors'], False)

        save_config({'verb_errors': 2})
        loader = ConfigLoader()
        loader.set_up_frame(ed)
        self.assertEqual(ed.get_values()['verb_errors'], True)
    def test_ConfigLoader_set_up_frame_ErrorDetails(self):
        ed = ErrorDetails()
        loader = ConfigLoader()
        loader.set_up_frame(ed)
        answer = {
            'error_probability': 0.2,
            'noun_errors': True,
            'pronoun_errors': False,
            'verb_errors': True,
            'is_do_errors': False,
            'preposition_transpose_errors': False,
            'punctuation_errors': True
        }

        self.assertEqual(ed.get_values(), answer)
    def test_ConfigLoader_set_up_frame_FileManagement(self):
        fm = FileManagement()
        loader = ConfigLoader()
        loader.set_up_frame(fm)
        home = os.path.join(get_documents_folder(), APP_NAME)
        answer = {
            'home_directory': home,
            'save_directory': os.path.join(home, DEFAULT_SAVE_DIR),
            'countable_nouns': os.path.join(home, COUNTABLE_NOUNS_CSV),
            'uncountable_nouns': os.path.join(home, UNCOUNTABLE_NOUNS_CSV),
            'proper_nouns': os.path.join(home, PROPER_NOUNS_CSV),
            'verbs': os.path.join(home, VERBS_CSV)
        }

        self.assertEqual(fm.get_values(), answer)