예제 #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