def test_get_list(self): """ Test retrieving a list of funds """ for data in test_data: result = Fund.get_list( filters=data.items(), pattern=data['pattern']) self.assertIsInstance(result, type([])) for fund, values in izip(result, data['expected']): self.assertIsInstance(fund, Fund) self.assertEqual(fund.code, values[0]) self.assertEqual(fund.description, values[1])
def test_get_dict(self): """ Test retrieving a dict of funds """ for data in test_data: result = Fund.get_dict( filters=data.items(), pattern=data['pattern']) self.assertIsInstance(result, type({})) for key_code, values in zip(sorted(result), data['expected']): fund = result[key_code] self.assertIsInstance(fund, Fund) self.assertEqual(fund.code, values[0]) self.assertEqual(fund.description, values[1]) self.assertEqual(key_code, values[0])