Example #1
0
 def valid(passphrase):
     return all_distinct(map(sorted, passphrase.split()))
Example #2
0
def test_alldistinct_failure5():
    # Changing next method
    with pytest.raises(_hf.CacheNext.EXC_TYP, match=_hf.CacheNext.EXC_MSG):
        all_distinct(_hf.CacheNext(1))
Example #3
0
 def valid(passphrase):
     return all_distinct(passphrase.split())
Example #4
0
def test_alldistinct_failure3():
    # Failure when comparing the object to the objects in the list
    with pytest.raises(_hf.FailEqNoHash.EXC_TYP,
                       match=_hf.FailEqNoHash.EXC_MSG):
        all_distinct([[T(1)], _hf.FailEqNoHash()])
Example #5
0
def test_alldistinct_failure4():
    # Failure (no TypeError) when trying to hash the value
    with pytest.raises(_hf.FailHash.EXC_TYP, match=_hf.FailHash.EXC_MSG):
        all_distinct([T(1), _hf.FailHash()])
Example #6
0
def test_alldistinct_failure1():
    with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG):
        all_distinct(_hf.FailIter())
Example #7
0
def test_alldistinct_failure2():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        all_distinct(_hf.FailNext())
Example #8
0
def test_alldistinct_unhashable2():
    assert not all_distinct([{T('a'): T(1)}, {T('a'): T(1)}])
Example #9
0
def test_alldistinct_normal3():
    # generator
    assert all_distinct((i for i in [T(1), T(2), T(3)]))
Example #10
0
def test_alldistinct_normal2():
    assert not all_distinct([T(1), T(1), T(1)])
Example #11
0
def test_alldistinct_normal1():
    assert all_distinct([T(1), T(2), T(3)])
Example #12
0
def test_alldistinct_empty1():
    assert all_distinct([])