test_chemked.py 文件源码

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

项目:PyKED 作者: pr-omethe-us 项目源码 文件源码
def test_conversion_to_respecth(self, filename_ck):
        """Test proper conversion to ReSpecTh XML.
        """
        file_path = os.path.join(filename_ck)
        filename = pkg_resources.resource_filename(__name__, file_path)
        c_true = ChemKED(filename)

        with TemporaryDirectory() as temp_dir:
            newfile = os.path.join(temp_dir, 'test.xml')
            c_true.convert_to_ReSpecTh(newfile)
            with pytest.warns(UserWarning) as record:
                c = ChemKED.from_respecth(newfile)

        m = str(record.pop(UserWarning).message)
        assert m == 'Using DOI to obtain reference information, rather than preferredKey.'

        assert c.file_authors[0]['name'] == c_true.file_authors[0]['name']

        assert c.reference.detail == 'Converted from ReSpecTh XML file {}'.format(os.path.split(newfile)[1])

        assert c.apparatus.kind == c_true.apparatus.kind
        assert c.experiment_type == c_true.experiment_type
        assert c.reference.doi == c_true.reference.doi
        assert len(c.datapoints) == len(c_true.datapoints)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号