Beispiel #1
0
def test_pop_to():
    '''Testing pop_to method'''
    assert units.id(0) == "10"
    assert units.value(0) == "ten"
    assert units.id(1) == "11"
    assert units.value(1) == "eleven"
    omits = Units('omits')
    assert len(units) == 4
    assert len(omits) == 0
    units.pop_to(omits, 0, 1)
    assert omits.id(0) == "11"
    assert omits.value(0) == "eleven"
    assert omits.id(1) == "10"
    assert omits.value(1) == "ten"
    assert len(units) == 2
    assert len(omits) == 2
Beispiel #2
0
def test_getattr():
    '''Testing getattr method'''
    data = [{"id": "10", "value": "ten", "suspect": "bar"},
            {"id": "11", "value": "eleven", "suspect": "bar"},
            {"id": "12", "value": "twelve", "suspect": "bar"},
            {"id": "13", "value": "thirteen", "suspect": "bar"}]
    units = Units('units', data)
    assert units.id(0) == "10"
    assert units.value(0) == "ten"
    assert units.suspect(0) == "bar"
    assert units.id(1) == "11"
    assert units.value(1) == "eleven"
    assert units.suspect(1) == "bar"