test_converters.py 文件源码

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

项目:PyKED 作者: pr-omethe-us 项目源码 文件源码
def test_missing_doi_period_at_end(self):
        """Ensure can handle missing DOI with period at end of reference.
        """
        root = etree.Element('experiment')
        ref = etree.SubElement(root, 'bibliographyLink')

        ref.set('preferredKey', 'Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
                'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
                'Fig. 12., right, open diamond.'
                )

        with pytest.warns(UserWarning) as record:
            ref = get_reference(root)
        m = str(record.pop(UserWarning).message)
        assert m == ('Missing doi attribute in bibliographyLink. Setting "detail" key as a '
                     'fallback; please update to the appropriate fields.')

        assert ref['detail'] == ('Chaumeix, N., Pichon, S., Lafosse, F., Paillard, C.-E., '
                                 'International Journal of Hydrogen Energy, 2007, (32) 2216-2226, '
                                 'Fig. 12., right, open diamond.'
                                 )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号