class CreditCardRecordTest(unittest.TestCase): def setUp(self): self.record_util = RecordUtil() self.record_translator = RecordTranslator() self.maxDiff = None def test_recordToJsonTest(self): record = self.record_util.initValidRecord() expected_record_json = self.record_util.initRecordJson() expected_record_json = self.record_util.initRecordJson() self.assertEqual(self.record_translator.translate_record_to_json(record), expected_record_json) def test_noneRecordToJsonTest(self): record = self.record_util.initInvalidRecord() record_json = self.record_util.initInvalidRecordJson() self.assertEqual(self.record_translator.translate_record_to_json(record).strip(), record_json.strip()) def test_emptyRecordToJsonTest(self): record = self.record_util.initEmptyRecord() record_json = self.record_util.initEmptyRecordJson() self.assertEqual(self.record_translator.translate_record_to_json(record).strip(), record_json.strip()) def test_recordListToJson(self): json_record_list = [] rec_list = self.record_util.initValidRecordList() for record in rec_list: rec = self.record_translator.translate_record_to_json(record) json_record_list.append(rec) expected_json_record_list = self.record_util.initRecordJsonList() self.assertEqual(self.record_translator.translate_record_list_to_json_list(json_record_list), expected_json_record_list)
def test_invalid_record_list_to_df_conversio(self): record_list = RecordUtil().initInvalidRecordList() returned_value = RecordStatisticsHandler().converRecordsToDf( record_list) expected_value = StatisticsUtil().init_record_df() print(returned_value) self.assertEquals(None, returned_value)
def test_data_group_by_year(self): record_list = RecordUtil().initValidRecordList() handler = RecordStatisticsHandler() records_df = handler.converRecordsToDf(record_list) expected_value = StatisticsUtil().init_record_df_grouped_by_year() returned_value = handler.group_df_data_by_year(records_df) self.assertTrue(returned_value.equals(expected_value))
def setUp(self): self.record_util = RecordUtil() self.record_translator = RecordTranslator() self.maxDiff = None
def test_record_list_to_df_conversio(self): record_list = RecordUtil().initValidRecordList() returned_value = RecordStatisticsHandler().converRecordsToDf( record_list) expected_value = StatisticsUtil().init_record_df() self.assertTrue(expected_value.equals(returned_value))