Skip to content

Instantly share code, notes, and snippets.

@dz0
Last active May 13, 2021 13:58
Show Gist options
  • Save dz0/4d5ed838f85688a309a4ab1540b24853 to your computer and use it in GitHub Desktop.
Save dz0/4d5ed838f85688a309a4ab1540b24853 to your computer and use it in GitHub Desktop.
from hamcrest import *
native = {
'runtime': {
'err': {'data validation': anything(), 'evaluation': anything()},
},
'schema': {
'sheet_names': {'err': {'missing': ['Loans']}},
},
'data': {
'info': {'info: planned repayment': anything(), 'info: factual repayment': anything()},
},
}
matcher = convert_nested_native_to_matcher(native)
# ==>
matcher = has_entries(
{
'runtime': has_entries(
{
'err': has_entries(
{'data validation': anything(), 'evaluation': anything()}
)
}
),
'schema': has_entries(
{'sheet_names': has_entries({'err': has_entries({'missing': contains_exactly('Loans')})})}
),
'data': has_entries(
{
'info': has_entries(
{
'info: planned repayment': anything(),
'info: factual repayment': anything(),
}
)
}
),
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment