1337dict.py 文件源码

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

项目:1337dict 作者: cym13 项目源码 文件源码
def test_drop_permutations():
    combination = ('ha', 'bc', 'de')
    varnum      = variations_number(''.join(combination))

    permutations, iteration = drop_permutations(0, combination)
    assert (list(permutations) ==
            [('ha', 'bc', 'de'), ('ha', 'de', 'bc'), ('bc', 'ha', 'de'),
             ('bc', 'de', 'ha'), ('de', 'ha', 'bc'), ('de', 'bc', 'ha')])
    assert iteration == 0

    permutations, iteration = drop_permutations(varnum-1, combination)
    assert (list(permutations) ==
            [('ha', 'bc', 'de'), ('ha', 'de', 'bc'), ('bc', 'ha', 'de'),
             ('bc', 'de', 'ha'), ('de', 'ha', 'bc'), ('de', 'bc', 'ha')])
    assert iteration == varnum-1

    permutations, iteration = drop_permutations(varnum+1, combination)
    assert (list(permutations) ==
            [                    ('ha', 'de', 'bc'), ('bc', 'ha', 'de'),
             ('bc', 'de', 'ha'), ('de', 'ha', 'bc'), ('de', 'bc', 'ha')])
    assert iteration == 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号