コード例 #1
0
def test_contains():
    with pf.Graph() as graph:
        test = pf.placeholder()
        alphabet = pf.constant('abc')
        contains = pf.contains(alphabet, test)

    assert graph(contains, {test: 'a'})
    assert not graph(contains, {test: 'x'})
コード例 #2
0
def test_contains():
    with pf.Graph() as graph:
        test = pf.placeholder()
        alphabet = pf.constant('abc')
        contains = pf.contains(alphabet, test)

    assert graph(contains, {test: 'a'})
    assert not graph(contains, {test: 'x'})
    # ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ #
    @slipform()
    def graph(test):
        alphabet = 'abc'
        contains = test in alphabet

    assert graph('contains', {'test': 'a'})
    assert not graph('contains', {'test': 'x'})