예제 #1
0
def test_adapt_all_with_none():
    """
    Verify passing None to adapt_all returns an empty generator
    """
    generator = adapt.adapt_all(None, int)

    with pytest.raises(StopIteration):
        generator.next()

    assert list(adapt.adapt_all(None, int)) == []
예제 #2
0
def test_adapt_all_list():
    """
    Verify adapt_all returns a list
    """
    int_like = ['1', 2.0]

    r = adapt.adapt_all(int_like, int)
    assert r[0] == 1
    assert r[1] == 2

    assert adapt.adapt_all(int_like, int) == [1, 2]
예제 #3
0
def test_adapt_all_generator():
    """
    Verify adapt_all returns a generator
    """
    int_like = ['1', 2.0]
    
    generator = adapt.adapt_all(int_like, int)
    assert generator.next() == 1
    assert generator.next() == 2

    assert list(adapt.adapt_all(int_like, int)) == [1, 2]
예제 #4
0
def test_adapt_all_list():
    """
    Verify adapt_all returns a list
    """
    int_like = ['1', 2.0]

    r = adapt.adapt_all(int_like, int)
    assert r[0] == 1
    assert r[1] == 2

    assert adapt.adapt_all(int_like, int) == [1, 2]
예제 #5
0
def test_adapt_all_with_none():
    """
    Verify passing None to adapt_all returns an empty list
    """
    r = adapt.adapt_all(None, int)
    assert r == []
    assert type(r) == list
예제 #6
0
def test_adapt_all_with_none():
    """
    Verify passing None to adapt_all returns an empty list
    """
    r = adapt.adapt_all(None, int)
    assert r == []
    assert type(r) == list