Beispiel #1
0
    def test_multiple(self):
        # first test, align string, no output, no input
        output = self.run_cli('multiple -s woldemort waldemar walter')
        self.assertIn('w\ta\tl\tt\te\t-\t-\tr\t-', output)

        # second test, test output as file, no input, vary method as sca
        mlt = main('multiple', '-s', 'woldemort', 'waldemar',
                                  'walter', '--method', 'sca', '--output-file',
                                  self.tmp_path('out.msa').as_posix())
        assert mlt[0] == list('woldemort')

        # third test, test output and input
        # second test, test output as file, no input, vary method as sca
        mlt = main('multiple', '-i', test_data('harryp.msa'),
                                  '--method', 'sca', '--output-file',
                                  self.tmp_path('out2.msa').as_posix(), '--align-method',
                                  'library')
        assert len(mlt[0]) == 7

        # fourth test, test output and input with method=basic
        mlt = main('multiple', '-i', test_data('harryp.msa'),
                                  '--method', 'basic', '--output-file',
                                  self.tmp_path('out2.msa').as_posix())
        assert len(mlt[0]) == 7
        assert len([x for x in mlt[1][-1] if x != '-']) == 4
Beispiel #2
0
def test_multiple(capsys, test_data, tmppath):
    # first test, align string, no output, no input
    output = run(capsys, 'multiple -s woldemort waldemar walter')
    assert 'w\ta\tl\tt\te\t-\t-\tr\t-' in output

    # second test, test output as file, no input, vary method as sca
    _ = run(capsys, 'multiple', '-s', 'woldemort', 'waldemar', 'walter',
            '--method', 'sca', '--output-file', str(tmppath / 'out.msa'))

    # third test, test output and input
    # second test, test output as file, no input, vary method as sca
    mlt = main('multiple', '-i', str(test_data / 'harryp.msa'), '--method',
               'sca', '--output-file', str(tmppath / 'out2.msa'),
               '--align-method', 'library')
    assert len(mlt[0]) == 7

    # fourth test, test output and input with method=basic
    mlt = main('multiple', '-i', str(test_data / 'harryp.msa'), '--method',
               'basic', '--output-file', str(tmppath / 'out2.msa'))
    assert len(mlt[0]) == 7
    assert len([x for x in mlt[1][-1] if x != '-']) == 4
Beispiel #3
0
    def test_multiple(self):
        # first test, align string, no output, no input
        output = self.run_cli('multiple -s woldemort waldemar walter')
        self.assertIn('w\ta\tl\tt\te\t-\t-\tr\t-', output)

        # second test, test output as file, no input, vary method as sca
        mlt = main('multiple', '-s', 'woldemort', 'waldemar', 'walter',
                   '--method', 'sca', '--output-file',
                   self.tmp_path('out.msa').as_posix())
        # third test, test output and input
        # second test, test output as file, no input, vary method as sca
        mlt = main('multiple', '-i', test_data('harryp.msa'), '--method',
                   'sca', '--output-file',
                   self.tmp_path('out2.msa').as_posix(), '--align-method',
                   'library')
        assert len(mlt[0]) == 7

        # fourth test, test output and input with method=basic
        mlt = main('multiple', '-i', test_data('harryp.msa'), '--method',
                   'basic', '--output-file',
                   self.tmp_path('out2.msa').as_posix())
        assert len(mlt[0]) == 7
        assert len([x for x in mlt[1][-1] if x != '-']) == 4
Beispiel #4
0
def capture(*args):
    out, sys.stdout = sys.stdout, StringIO()
    main(*args)
    sys.stdout.seek(0)
    yield sys.stdout.read()
    sys.stdout = out
Beispiel #5
0
 def test_lexstat(self):
     cogs = main('lexstat', '-i',
                               test_data('KSL.qlc'),
                               '--output-file', self.tmp_path('lexstat').as_posix())
     assert cogs == 1080
Beispiel #6
0
from lingpy.cli import main

main()
Beispiel #7
0
def capture(*args):
    out, sys.stdout = sys.stdout, StringIO()
    main(*args)
    sys.stdout.seek(0)
    yield sys.stdout.read()
    sys.stdout = out
Beispiel #8
0
 def test_lexstat(self):
     cogs = main('lexstat', '-i', test_data('KSL.qlc'), '--output-file',
                 self.tmp_path('lexstat').as_posix())
     assert cogs == 1080
Beispiel #9
0
 def test_profile(self):
     prf = main('profile', '-i', test_data('KSL.qlc'), '--column', 'ipa')
     assert prf == 105
     prf = main('profile', '-i', test_data('KSL.qlc'), '--column', 'ipa',
                '--language', 'German', '--count')
     assert prf == 37
Beispiel #10
0
 def test_lexstat(self):
     # TODO check with other python versions
     cogs = main('lexstat', '-i', test_data('KSL.qlc'), '--output-file',
                 self.tmp_path('lexstat').as_posix())
     print(cogs)
     assert cogs in [1080, 1081]
Beispiel #11
0
def run(capsys, *args):
    if len(args) == 1:
        args = shlex.split(args[0])
    main(*args)
    return capsys.readouterr().out
Beispiel #12
0
def test_lexstat(test_data, tmppath):
    # TODO check with other python versions
    cogs = main('lexstat', '-i', str(test_data / 'KSL.qlc'), '--output-file',
                str(tmppath / 'lexstat'))
    print(cogs)
    assert cogs in [1080, 1081]
Beispiel #13
0
from lingpy.cli import main
main()