| Conditions | 4 |
| Total Lines | 17 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # useful methods to measure time performance by small pieces of code |
||
| 14 | def test_add_and_shift_column(self): |
||
| 15 | class_ln = LoggingNeeds() |
||
| 16 | class_ln.initiate_logger('None', __file__) |
||
| 17 | timer = Timer(__file__, text='Time spent is {seconds}', logger=class_ln.logger.debug) |
||
| 18 | class_fo = FileOperations() |
||
| 19 | # load testing values from JSON file where all cases are grouped |
||
| 20 | json_structure = class_fo.fn_open_file_and_get_content('series.json') |
||
| 21 | for crt_series in json_structure: |
||
| 22 | in_data_frame = pandas.DataFrame(crt_series['Given']) |
||
| 23 | class_dm = DataManipulator() |
||
| 24 | out_data_frame = class_dm.fn_add_and_shift_column(class_ln.logger, timer, in_data_frame, [ |
||
| 25 | crt_series['Parameters'] |
||
| 26 | ]) |
||
| 27 | out_data_frame[['Column_New']] = out_data_frame[['Column_New']]\ |
||
| 28 | .apply(lambda x: int(x) if re.match('^[+-]*[0-9]+(\.{1}0*)*$', str(x)) else x) |
||
| 29 | expected_data_frame = pandas.DataFrame(crt_series['Expected']) |
||
| 30 | self.assertDictEqual(out_data_frame.to_dict(), expected_data_frame.to_dict()) |
||
| 31 |