tests.py 文件源码

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

项目:nom 作者: frnsys 项目源码 文件源码
def test_convert_spans(self):
        expected = '''
            <p>
                <em><strong>
                    foobar
                    <em>
                        lala
                        <strong>
                            yum
                        </strong>
                    </em>
                    <span>
                        hey hey
                    </span>
                    <strong>
                        uh oh
                    </strong>
                    <span>
                        yes
                    </span>
                </strong></em>
            </p>
        '''

        h = fromstring(html)
        for span in h.findall('.//span'):
            html2md.convert_span(span)
        result = tostring(h).decode('utf-8')

        results = [x.replace('\n', '').replace(' ', '') for x in [result, expected]]
        print('=========')
        print(results[0])
        print('=========')
        print(results[1])
        self.assertEqual(results[0], results[1])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号