Beispiel #1
0
def named_list():
    return NamedList(['foo', 'bar', 'baz'], [51, 72, 93])
Beispiel #2
0
def test_index_NL():
    named_list = NamedList(['foo', 'bar', 'baz'], [51, 72, 93], start_index=3)
    assert named_list.index('foo') == '3'
    assert named_list.index('baz') == '5'
Beispiel #3
0
def test_setitem_NL():
    nltest = NamedList(['foo', 'bar', 'baz'], [51, 72, 93])
    nltest['qux'] = -21
    assert nltest['qux'] == -21
Beispiel #4
0
def test_len_NL():
    nltest = NamedList(['foo', 'bar', 'baz'], [51, 72, 93])
    assert len(nltest) == 3
Beispiel #5
0
def test_getitem_NL():
    nltest = NamedList(['foo', 'bar', 'baz'], [5, 7, 9])
    assert nltest['1'] == 5
    assert nltest['baz'] == 9
Beispiel #6
0
def test_init_NL():
    nltest = NamedList(['foo', 'bar'], [511, 522])