def test_MyParser_parseDict(db, meta): parser = MyParser() parser.parseDict(db['Ni_gr'], meta=meta) recipe = multi_phase([db['Ni_stru']], parser, fit_range=(0., 8., .1)) con = next(iter(recipe.contributions.values())) gen = next(iter(con.generators.values())) # if meta = None, generator will use the default values assert gen.getQmin() == parser._meta.get('qmin', 0.0) assert gen.getQmax() == parser._meta.get('qmax', 100. * np.pi) assert gen.qdamp.value == parser._meta.get('qdamp', 0.0) assert gen.qbroad.value == parser._meta.get('qbroad', 0.0)
def test_MyParser_parseDict_error(data): parser = MyParser() with pytest.raises(ValueError): parser.parseDict(data)