Beispiel #1
0
def test_comment_attributes():
    c = Comment('a')
    assert c.source == 'a'
Beispiel #2
0
def test_comment_value(s,v):
    assert Comment(s).value == v
Beispiel #3
0
def test_comment_is_timestamp(c, is_t):
    assert Comment(c).is_timestamp() == is_t
Beispiel #4
0
def test_comment_source_stripped(s, ss):
    assert Comment(s).source_stripped == ss
Beispiel #5
0
@pytest.mark.parametrize('s,objects', [
    ('', []),
    ('\n', [Whitespace('\n')]),
    (' \n\t\n', [Whitespace(' \n'), Whitespace('\t\n')]),
    ('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'),
        ],
    ),
    (
        '#Before blank\n'
        '\n'
        '#After blank\n'
        '\n'
        'before=blank\n'
        '\n'
        'after=blank\n',
        [
            Comment('#Before blank\n'),