test_grammar.py 文件源码

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

项目:qiime2 作者: qiime2 项目源码 文件源码
def test_hashable(self):
        a = grammar.TypeExpression('X')
        b = grammar.TypeExpression('Y', fields=(a,))
        c = grammar.TypeExpression('Y', fields=(a,))
        d = grammar.TypeExpression('Z', predicate=grammar.Predicate("stuff"))

        self.assertIsInstance(a, collections.Hashable)
        # There really shouldn't be a collision between these:
        self.assertNotEqual(hash(a), hash(d))

        self.assertEqual(b, c)
        self.assertEqual(hash(b), hash(c))

    # TODO: Test dictionaries work well
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号