Example #1
0
def validate(request):
    before, after = request.split('..')

    # With a pipe
    if os.name == 'nt':
        py.test.skip()
    command = ('$R --quiet --force < %s %s'
               '| $R --quiet --force %s..%s'
               % (input_name, request, after, before))
    print(command)
    output = common.external_output(command)
    common.assert_or_diff(output, input)

    # With an intermediate file
    with open(common.run.work, 'w') as f:
        f.write(input)
    command1 = ('$R --quiet --force %s %s'
                % (request, common.run.work))
    command2 = ('$R --quiet --force %s..%s %s'
                % (after, before, common.run.work))
    print(command1)
    print(command2)
    common.external_output(command1)
    common.external_output(command2)
    with open(common.run.work) as f:
        output = f.read()
    common.assert_or_diff(output, input)
Example #2
0
def validate(request, sequence, mode):
    before, after = request.split('..')
    if mode == 'filter':
        if os.name == 'nt':
            py.test.skip()
        command = ('$R --quiet --force --sequence=%s < %s %s'
                   '| $R --quiet --force --sequence=%s %s..%s' %
                   (sequence, input_name, request, sequence, after, before))
        print command
        output = common.external_output(command)
    elif mode == 'squash':
        file(common.run.work, 'wb').write(input)
        command1 = ('$R --quiet --force --sequence=%s %s %s' %
                    (sequence, request, common.run.work))
        command2 = ('$R --quiet --force --sequence=%s %s..%s %s' %
                    (sequence, after, before, common.run.work))

        print command1
        print command2
        common.external_output(command1)
        common.external_output(command2)
        output = file(common.run.work, 'rb').read()
    else:
        assert False, mode
    common.assert_or_diff(output, input)
Example #3
0
def validate(request, sequence, mode):
    before, after = request.split('..')
    if mode == 'filter':
        command = ('$R --quiet --force --sequence=%s < %s %s'
                   '| $R --quiet --force --sequence=%s %s..%s'
                   % (sequence, input_name, request, sequence, after, before))
        print command
        output = common.external_output(command)
    elif mode == 'squash':
        file(common.run.work, 'wb').write(input)
        command1 = ('$R --quiet --force --sequence=%s %s %s'
                    % (sequence, request, common.run.work))
        command2 = ('$R --quiet --force --sequence=%s %s..%s %s'
                    % (sequence, after, before, common.run.work))

        print command1
        print command2
        common.external_output(command1)
        common.external_output(command2)
        output = file(common.run.work, 'rb').read()
    else:
        assert False, mode
    common.assert_or_diff(output, input)
Example #4
0
 def test_1(self):
     output = common.external_output('$R -lh latin-1')
     common.assert_or_diff(output, self.expected)
Example #5
0
 def test_1(self):
     output = common.external_output('$R -lh latin-1')
     common.assert_or_diff(output, self.expected)
Example #6
0
def test_1():
    output = common.external_output('$R -l')
    common.assert_or_diff(output, expected)
Example #7
0
def test_1():
    output = common.external_output('$R --ignore=:iconv: -l')
    common.assert_or_diff(output, expected)
Example #8
0
def test_1():
    output = common.external_output('$R --find-subsets')
    # FIXME: The output is not sorted appropriately.
    output2 = ''.join(sorted(output.splitlines(True)))
    expected2 = ''.join(sorted(expected.splitlines(True)))
    common.assert_or_diff(output2, expected2)
Example #9
0
def test_1():
    output = common.external_output('$R -T')
    # FIXME: The output is not sorted appropriately.
    output2 = ''.join(sorted(output.splitlines(True)))
    expected2 = ''.join(sorted(expected.splitlines(True)))
    common.assert_or_diff(output2, expected2)