Beispiel #1
0
    def _parse(self):
        parser = DotconfParser(self._config,
                               debug=False,
                               write_tables=False,
                               errorlog=yacc.NullLogger())

        return parser.parse()
Beispiel #2
0
def test_parser_basic():
    test = '''
    daemon = yes  # This is a comment after an assignation
    # This is comment
    '''
    parser = DotconfParser(test)
    output = parser.parse()
    assert output.get('daemon') is True
Beispiel #3
0
def test_parser_basic():
    test = '''
    daemon = yes  # This is a comment after an assignation
    # This is comment
    '''
    parser = DotconfParser(test)
    output = parser.parse()
    assert output.get('daemon') is True
Beispiel #4
0
def test_parser_section():
    test = '''
    section1 {
        key = 'test'
    }
    section2 'arg' {}
    section3 'arg1', 'arg2' {}
    '''
    parser = DotconfParser(test)
    output = parser.parse()
    assert tuple(output.subsections('section1'))[0].get('key') == 'test'
    assert tuple(output.subsections('section2'))[0].args == ['arg']
    assert tuple(output.subsections('section3'))[0].args == ['arg1', 'arg2']
Beispiel #5
0
def test_parser_section():
    test = '''
    section1 {
        key = 'test'
    }
    section2 'arg' {}
    section3 'arg1', 'arg2' {}
    '''
    parser = DotconfParser(test)
    output = parser.parse()
    assert tuple(output.subsections('section1'))[0].get('key') == 'test'
    assert tuple(output.subsections('section2'))[0].args == ['arg']
    assert tuple(output.subsections('section3'))[0].args == ['arg1', 'arg2']
Beispiel #6
0
def test_parser_list():
    test = '''
    list1 = 1, 2, 3
    list2 = 1, 2, 3,
    list3 = 1,
    list4 = 1,
            2,
            3
    list5 = 1,
            2,
            3,
    '''
    parser = DotconfParser(test)
    output = parser.parse()
    assert output.get('list1') == [1, 2, 3]
    assert output.get('list2') == [1, 2, 3]
    assert output.get('list3') == [1]
    assert output.get('list4') == [1, 2, 3]
    assert output.get('list5') == [1, 2, 3]
Beispiel #7
0
def test_parser_list():
    test = '''
    list1 = 1, 2, 3
    list2 = 1, 2, 3,
    list3 = 1,
    list4 = 1,
            2,
            3
    list5 = 1,
            2,
            3,
    '''
    parser = DotconfParser(test)
    output = parser.parse()
    assert output.get('list1') == [1, 2, 3]
    assert output.get('list2') == [1, 2, 3]
    assert output.get('list3') == [1]
    assert output.get('list4') == [1, 2, 3]
    assert output.get('list5') == [1, 2, 3]
Beispiel #8
0
    def _parse(self):
        parser = DotconfParser(self._config, debug=False, write_tables=False,
                               errorlog=yacc.NullLogger())

        return parser.parse()
Beispiel #9
0
def test_parser_empty():
    test = ''''''
    parser = DotconfParser(test)
    output = parser.parse()
Beispiel #10
0
def test_parser_empty():
    test = ''''''
    parser = DotconfParser(test)
    output = parser.parse()