Пример #1
0
def test_get_links_from_boolvector(small):
    cids = gg.intvector([3, 5])
    allowed = gg.boolvector()
    small.get_links_from(cids, allowed)
    assert list(allowed) == [False, True, False, False, True]
    assert list(cids) == [3, 5]

    allowed = gg.boolvector()
    cids.append(1)
    small.get_links_from(cids, allowed)

    assert list(allowed) == [False, True, True, False, True]
Пример #2
0
def test_get_links_from_boolvector_empty(small):
    cids = gg.intvector()
    allowed = gg.boolvector()
    small.get_links_from(cids, allowed)
    assert list(allowed) == [False] * 5

    allowed[1] = True
    small.get_links_from(cids, allowed)
    assert list(allowed) == [False, True, False, False, False]
Пример #3
0
def test_get_links_from_allowed(small):
    cids = gg.intvector([3, 5])
    result = gg.boolvector()
    allowed = gg.boolvector()
    small.get_links_from(cids, result, allowed)
    assert list(result) == [False, False, False, False, False]

    allowed.resize(10)
    small.get_links_from(cids, result, allowed)
    assert list(result) == [False, False, False, False, False]

    allowed[1] = True
    small.get_links_from(cids, result, allowed)
    assert list(result) == [False, True, False, False, False]

    for i in range(10):
        allowed[i] = True
    small.get_links_from(cids, result, allowed)
    assert list(result) == [False, True, False, False, True]
Пример #4
0
def test_get_links_from_boolvector_return(gr):
    allowed = gg.boolvector()
    cids = gg.intvector()
    cids.append(1)
    res = gr.get_links_from(cids, allowed)
    assert res is allowed