Exemplo n.º 1
0
    def test_fill_settings(self):
        sections = {"test": self.section}
        with simulate_console_inputs() as generator:
            fill_settings(sections, acquire_settings, self.log_printer)
            self.assertEqual(generator.last_input, -1)

        self.section.append(Setting("bears", "SpaceConsistencyTestBear"))

        with simulate_console_inputs("True"), bear_test_module():
            local_bears, global_bears = fill_settings(sections,
                                                      acquire_settings,
                                                      self.log_printer)
            self.assertEqual(len(local_bears["test"]), 1)
            self.assertEqual(len(global_bears["test"]), 0)

        self.assertEqual(bool(self.section["use_spaces"]), True)
        self.assertEqual(len(self.section.contents), 3)
Exemplo n.º 2
0
    def test_fill_settings(self):
        sections = {'test': self.section}
        with simulate_console_inputs() as generator:
            fill_settings(sections, acquire_settings, self.log_printer)
            self.assertEqual(generator.last_input, -1)

        self.section.append(Setting('bears', 'SpaceConsistencyTestBear'))

        with simulate_console_inputs('True'), bear_test_module():
            local_bears, global_bears = fill_settings(sections,
                                                      acquire_settings,
                                                      self.log_printer)
            self.assertEqual(len(local_bears['test']), 1)
            self.assertEqual(len(global_bears['test']), 0)

        self.assertEqual(bool(self.section['use_spaces']), True)
        self.assertEqual(len(self.section.contents), 3)
Exemplo n.º 3
0
 def setUp(self):
     self.log_printer = LogPrinter(ConsolePrinter())
     self.section = Section("test")
     self.section.append(Setting("key", "val"))
Exemplo n.º 4
0
 def setUp(self):
     self.log_printer = LogPrinter(ConsolePrinter())
     self.section = Section('test')
     self.section.append(Setting('key', 'val'))
     self.empty_section = Section('')