Пример #1
0
def test_set_bad_type(t):
    s = zini.Section()
    s['a'] = t
    assert isinstance(s['a'], zini.GenericParser)
Пример #2
0
def test_set_bad_key():
    s = zini.Section()

    with pytest.raises(TypeError):
        s[13] = int
Пример #3
0
def test_create_empty():
    s = zini.Section()
    assert not s
Пример #4
0
def test_set_list_item_parser(value, item_parser_class):
    s = zini.Section()
    s['a'] = value
    assert s
    assert isinstance(s['a'], zini.ListParser)
    assert isinstance(s['a'].item_parser, item_parser_class)
Пример #5
0
def test_set_default(value, parser_class):
    s = zini.Section()
    s['a'] = value
    assert s
    assert isinstance(s['a'], parser_class)
Пример #6
0
def test_set_parser():
    s = zini.Section()
    parser = zini.BooleanParser()
    s['a'] = parser
    assert s['a'] is parser
Пример #7
0
def test_set_type(t, parser_class):
    s = zini.Section()
    s['a'] = t
    assert s
    assert isinstance(s['a'], parser_class)
Пример #8
0
def test_del():
    s = zini.Section()
    s['a'] = int
    assert s
    del s['a']
    assert not s
Пример #9
0
def test_create():
    s = zini.Section({'a': int})
    assert s
    assert 'a' in s