Skip to content

Commit b7b5fe4

Browse files
damienbarkerjenkins
authored andcommitted
QPR-12066 -- Add CRIF match regression tests
1 parent fca4e16 commit b7b5fe4

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

Tools/PythonTools/compare_files.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,17 @@ def compare_files_df(name, file_1, file_2, config):
397397
if 'optional_cols' in config:
398398
optional_cols = copy.deepcopy(config['optional_cols'])
399399
logger.debug('Optional columns found: %s', str (optional_cols))
400+
401+
# Check that each optional col either exists in both DataFrames, or is missing in both. Otherwise, we fail the test.
402+
missing_ocols = []
403+
for col in optional_cols:
404+
if (col in df_1.columns and col not in df_2.columns) or (col not in df_1.columns and col in df_2.columns):
405+
missing_ocols.append(col)
406+
if missing_ocols:
407+
logger.warning('The columns, %s, are in one Dataframe but not the other.', str(missing_ocols))
408+
return False
409+
410+
# For each optional col, check whether it is found in each DataFrame. If so, add it.
400411
for col in optional_cols:
401412
if col in df_1.columns and col in df_2.columns :
402413
logger.debug('Adding optional column %s to list of columns for comparison', col)

Tools/PythonTools/comparison_config.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,24 @@
227227
"TradeType"
228228
],
229229
"optional_cols": [
230-
"BaseCurrency"
230+
"BaseCurrency",
231+
"end_date",
232+
"trade_date",
233+
"notional",
234+
"trade_currency",
235+
"notional2",
236+
"trade_currency2",
237+
"underlying",
238+
"mtm_curr",
239+
"mtm_value",
240+
"settlement_type",
241+
"strike",
242+
"call_put",
243+
"long_short",
244+
"asset_class",
245+
"base_product",
246+
"sub_product",
247+
"xccy_resettable"
231248
],
232249
"optional_keys": [
233250
"collect_regulations",

0 commit comments

Comments
 (0)