コード例 #1
0
def test_isin(x):
    """
    Given a sequence, and a value from the sequence, when isin() is called with
    the sequence, then it returns a function that returns the value when called
    with it.
    """
    v, seq = x
    validator = mod.isin(seq)
    assert validator(v) == v
コード例 #2
0
def test_isin(x):
    """
    Given a sequence, and a value from the sequence, when isin() is called with
    the sequence, then it returns a function that returns the value when called
    with it.
    """
    v, seq = x
    validator = mod.isin(seq)
    assert validator(v) == v
コード例 #3
0
def test_isin_not_found(x):
    """
    Given a sequence, and a value that does not belong to it, when isin() is
    called with the sequence, then it returns a function that raises ValueError
    when called with the value.
    """
    v, seq = x
    validator = mod.isin(seq)
    with pytest.raises(ValueError):
        validator(v)
コード例 #4
0
def test_isin_not_found(x):
    """
    Given a sequence, and a value that does not belong to it, when isin() is
    called with the sequence, then it returns a function that raises ValueError
    when called with the value.
    """
    v, seq = x
    validator = mod.isin(seq)
    with pytest.raises(ValueError):
        validator(v)