def test_main_summary(self):
     """Test if babynames.main() creates summary files"""
     # First remove any existing summary files
     self.remove_extension_files('.summary')
     cmdline = ['--summaryfile']
     cmdline.extend(glob.glob('baby*.html'))
     babynames.main(cmdline)
     files = glob.glob('*.summary')
     self.assertEqual(len(files), 10)
    def test_main_print(self):
        """Test if babynames.main() prints output list"""
        self.remove_extension_files('.summary')

        with Capturing() as output:
            babynames.main(['baby1990.html'])
        self.assertIsInstance(output, list)

        # Compare captured output to list from file
        baby1990_list = self.get_summary_file_as_list(
            os.path.join('tests', 'baby1990.html.summary'))
        self.assertListEqual(output, baby1990_list)

        # Also check that no summary file was created
        self.assertFalse(
            glob.glob('*.summary'),
            msg='A summary file should not be created. Just printing.')