test_chemked.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:PyKED 作者: pr-omethe-us 项目源码 文件源码
def test_absolute_asym_comp_uncertainty(self):
        properties = self.load_properties('testfile_uncertainty.yaml')
        with pytest.warns(UserWarning) as record:
            d = DataPoint(properties[0])
        m = str(record.pop(UserWarning).message)
        assert m == ('Asymmetric uncertainties are not supported. The maximum of lower-uncertainty '
                     'and upper-uncertainty has been used as the symmetric uncertainty.')
        assert np.isclose(d.composition[2]['amount'].value, Q_(99.0))
        assert np.isclose(d.composition[2]['amount'].error, Q_(1.0))

        with pytest.warns(UserWarning) as record:
            d = DataPoint(properties[1])
        m = str(record.pop(UserWarning).message)
        assert m == ('Asymmetric uncertainties are not supported. The maximum of lower-uncertainty '
                     'and upper-uncertainty has been used as the symmetric uncertainty.')
        assert np.isclose(d.composition[2]['amount'].value, Q_(99.0))
        assert np.isclose(d.composition[2]['amount'].error, Q_(1.0))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号