コード例 #1
0
    def test_search(self):
        target = UsdaFoodCatalog(os.path.join(script_dir, self.test_data_file_name))
        target.initialize()

        actual1 = target.find('Whipped cream substitute is very tasty')
        expected1 = [('Whipped cream substitute', 'Dairy and Egg Products')]

        self.assertCountEqual(actual1, expected1)

        actual2 = target.find('It\'s appear to be that eggs with whipped cream substitute are very tasty')
        expected2 = [('whipped cream substitute', 'Dairy and Egg Products'), ('eggs', 'Dairy and Egg Products')]

        self.assertCountEqual(actual2, expected2)
コード例 #2
0
 def test_initialize(self):
     target = UsdaFoodCatalog(os.path.join(script_dir, self.test_data_file_name))
     target.initialize()