

def testParser(self):
    test_data = '\n    key1 = a list of \\\n      fields # but not \\n this, or \\ this.\n\n    # Nothing here.\n    key 2:another entry\n    = # Bad line\n    \'a key\'with" no" value field ;; and not this comment.\n    '
    expected = [{
        'key1': ['a', 'list', 'of', 'fields'],
    }, {
        'key 2': ['another', 'entry'],
    }, {
        'a keywith no value field': [],
    }]
    cfg = config_file.KeyValueParser(kv_sep=['=', ':'], comments=['#', ';;'])
    results = cfg.ParseEntries(test_data)
    for (i, expect) in enumerate(expected):
        self.assertDictEqual(expect, results[i])

dataset/ETHPy150Open google/grr/grr/parsers/config_file_test.py KeyValueParserTests.testParser/original