test_converters.py 文件源码

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

项目:PyKED 作者: pr-omethe-us 项目源码 文件源码
def test_incorrect_doi_period_at_end(self, capfd):
        """Ensure can handle invalid DOI with period at end of reference.
        """
        root = etree.Element('experiment')
        ref = etree.SubElement(root, 'bibliographyLink')
        ref.set('doi', '10.1000/invalid.doi')
        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 or lookup failed. 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.'
                )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号