Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_dftd3__from_arrays(inp, expected):
res = empirical_dispersion_resources.from_arrays(**inp[0])
assert compare_recursive(expected, res, atol=1.e-4)
assert compare(inp[1], _compute_key(res), 'key')
res = empirical_dispersion_resources.from_arrays(name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
assert compare_recursive(expected, res, tnm() + ' idempotent', atol=1.e-4)
def test_dftd3__from_arrays__supplement():
ans = {
'dashlevel': 'chg',
'dashparams': {
's6': 4.05
},
'fctldash': 'asdf-d4',
'dashparams_citation': ' mypaper\n'
}
supp = {'chg': {'definitions': {'asdf-d4': {'params': {'s6': 4.05}, 'citation': ' mypaper\n'}}}}
res = empirical_dispersion_resources.from_arrays(name_hint='asdf-d4', level_hint='chg', dashcoeff_supplement=supp)
assert compare_recursive(ans, res, atol=1.e-4)
with pytest.raises(qcng.exceptions.InputError) as e:
empirical_dispersion_resources.from_arrays(name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
assert "Can't guess -D correction level" in str(e.value)
res = empirical_dispersion_resources.from_arrays(
name_hint=res['fctldash'],
level_hint=res['dashlevel'],
param_tweaks=res['dashparams'],
dashcoeff_supplement=supp)
assert compare_recursive(ans, res, tnm() + ' idempotent', atol=1.e-4)