test_parser.py 文件源码

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

项目:Dshield 作者: ywjt 项目源码 文件源码
def testDuckTyping(self):
        # We want to support arbitrary classes that implement the stream
        # interface.

        class StringPassThrough(object):
            def __init__(self, stream):
                self.stream = stream

            def read(self, *args, **kwargs):
                return self.stream.read(*args, **kwargs)


        dstr = StringPassThrough(StringIO('2014 January 19'))

        self.assertEqual(parse(dstr), datetime(2014, 1, 19))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号