How to use the javaproperties.KeyValue function in javaproperties

To help you get started, we’ve selected a few javaproperties examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jwodder / javaproperties / test / test_parse.py View on Github external
    ('key=value\n', [KeyValue('key', 'value', 'key=value\n')]),
    (u'\xF0=\u2603\n', [KeyValue(u'\xF0', u'\u2603', u'\xF0=\u2603\n')]),
    ('\\u00F0=\\u2603\n', [KeyValue(u'\xF0', u'\u2603', '\\u00F0=\\u2603\n')]),
    (' key :\t value \n', [KeyValue('key', 'value ', ' key :\t value \n')]),
    (
        '#This is a comment.\n'
        '# So is this.\n'
        'comment: no\n'
        ' ! Also a comment\n',
        [
            Comment('#This is a comment.\n'),
            Comment('# So is this.\n'),
            KeyValue('comment', 'no', 'comment: no\n'),
            Comment(' ! Also a comment\n'),
        ],
    ),
    (
github jwodder / javaproperties / test / test_parse.py View on Github external
    (' key :\t value \n', [KeyValue('key', 'value ', ' key :\t value \n')]),
    (
        '#This is a comment.\n'
        '# So is this.\n'
        'comment: no\n'
        ' ! Also a comment\n',
        [
            Comment('#This is a comment.\n'),
            Comment('# So is this.\n'),
            KeyValue('comment', 'no', 'comment: no\n'),
            Comment(' ! Also a comment\n'),
        ],
    ),
    (
        '#Before blank\n'
        '\n'
        '#After blank\n'
github jwodder / javaproperties / test / test_parse.py View on Github external
            KeyValue('comment', 'no', 'comment: no\n'),
            Comment(' ! Also a comment\n'),
        ],
    ),
    (
        '#Before blank\n'
        '\n'
        '#After blank\n'
        '\n'
        'before=blank\n'
        '\n'
        'after=blank\n',
        [
            Comment('#Before blank\n'),
            Whitespace('\n',),
            Comment('#After blank\n'),
            Whitespace('\n'),
github jwodder / javaproperties / test / test_parse.py View on Github external
def test_keyvalue_source_stripped(s, ss):
    assert KeyValue(None, None, s).source_stripped == ss
github jwodder / javaproperties / test / test_parse.py View on Github external
    (u'\xF0=\u2603\n', [KeyValue(u'\xF0', u'\u2603', u'\xF0=\u2603\n')]),
    ('\\u00F0=\\u2603\n', [KeyValue(u'\xF0', u'\u2603', '\\u00F0=\\u2603\n')]),
    (' key :\t value \n', [KeyValue('key', 'value ', ' key :\t value \n')]),
    (
        '#This is a comment.\n'
        '# So is this.\n'
        'comment: no\n'
        ' ! Also a comment\n',
        [
            Comment('#This is a comment.\n'),
            Comment('# So is this.\n'),
            KeyValue('comment', 'no', 'comment: no\n'),
            Comment(' ! Also a comment\n'),
        ],
    ),
    (
        '#Before blank\n'
github jwodder / javaproperties / test / test_parse.py View on Github external
    ('key va\\\n', [KeyValue('key', 'va', 'key va\\\n')]),
    ('key va\\', [KeyValue('key', 'va', 'key va\\')]),
    (' \\\n\t\\\r\n\f\\\r \n', [Whitespace(' \\\n\t\\\r\n\f\\\r \n')]),
    (
        'key = v\\\n\ta\\\r\n\fl\\\r u\\\ne\n',
        [KeyValue('key', 'value', 'key = v\\\n\ta\\\r\n\fl\\\r u\\\ne\n')],
    ),
])
def test_parse(s, objects):
    assert list(parse(s)) == objects
github jwodder / javaproperties / test / test_parse.py View on Github external
    ('key va\\\n lue\n', [KeyValue('key', 'value', 'key va\\\n lue\n')]),
    ('key va\\\n', [KeyValue('key', 'va', 'key va\\\n')]),
    ('key va\\', [KeyValue('key', 'va', 'key va\\')]),
    (' \\\n\t\\\r\n\f\\\r \n', [Whitespace(' \\\n\t\\\r\n\f\\\r \n')]),
    (
        'key = v\\\n\ta\\\r\n\fl\\\r u\\\ne\n',
        [KeyValue('key', 'value', 'key = v\\\n\ta\\\r\n\fl\\\r u\\\ne\n')],
    ),
])
def test_parse(s, objects):
    assert list(parse(s)) == objects
github jwodder / javaproperties / test / test_parse.py View on Github external
    ('\\u00F0=\\u2603\n', [KeyValue(u'\xF0', u'\u2603', '\\u00F0=\\u2603\n')]),
    (' key :\t value \n', [KeyValue('key', 'value ', ' key :\t value \n')]),
    (
        '#This is a comment.\n'
        '# So is this.\n'
        'comment: no\n'
        ' ! Also a comment\n',
        [
            Comment('#This is a comment.\n'),
            Comment('# So is this.\n'),
            KeyValue('comment', 'no', 'comment: no\n'),
            Comment(' ! Also a comment\n'),
        ],
    ),
    (
        '#Before blank\n'
        '\n'
github jwodder / javaproperties / test / test_parse.py View on Github external
            KeyValue('after', 'blank', 'after=blank\n'),
        ],
    ),
    ('key va\\\n lue\n', [KeyValue('key', 'value', 'key va\\\n lue\n')]),
    ('key va\\\n', [KeyValue('key', 'va', 'key va\\\n')]),
    ('key va\\', [KeyValue('key', 'va', 'key va\\')]),
    (' \\\n\t\\\r\n\f\\\r \n', [Whitespace(' \\\n\t\\\r\n\f\\\r \n')]),
    (
        'key = v\\\n\ta\\\r\n\fl\\\r u\\\ne\n',
        [KeyValue('key', 'value', 'key = v\\\n\ta\\\r\n\fl\\\r u\\\ne\n')],
    ),
])
def test_parse(s, objects):
    assert list(parse(s)) == objects
github jwodder / javaproperties / test / test_parse.py View on Github external
            KeyValue('before', 'blank', 'before=blank\n'),
            Whitespace('\n'),
            KeyValue('after', 'blank', 'after=blank\n'),
        ],
    ),
    ('key va\\\n lue\n', [KeyValue('key', 'value', 'key va\\\n lue\n')]),
    ('key va\\\n', [KeyValue('key', 'va', 'key va\\\n')]),
    ('key va\\', [KeyValue('key', 'va', 'key va\\')]),
    (' \\\n\t\\\r\n\f\\\r \n', [Whitespace(' \\\n\t\\\r\n\f\\\r \n')]),
    (
        'key = v\\\n\ta\\\r\n\fl\\\r u\\\ne\n',
        [KeyValue('key', 'value', 'key = v\\\n\ta\\\r\n\fl\\\r u\\\ne\n')],
    ),
])
def test_parse(s, objects):
    assert list(parse(s)) == objects