Exemplo n.º 1
0
 def test_command_parsing_for_issue_10(self):
     cmd = "nosetests -v -a !deferred --with-doctest []"
     p = CommandParser(cmd)
     parsed = list(p.words())
     assert parsed == [
         'nosetests', ' ', '-v', ' ', '-a', ' ', '!deferred', ' ',
         '--with-doctest', ' ', '[]'
     ]
Exemplo n.º 2
0
 def test_command_with_split_line_in_subst_arguments(self):
     cmd = dedent(""" cmd2 {posargs:{item2}
                      other}""")
     p = CommandParser(cmd)
     parsed = list(p.words())
     assert parsed == [
         'cmd2', ' ', '{posargs:{item2}\n                        other}'
     ]
Exemplo n.º 3
0
    def test_command_parser_with_complex_word_set(self):
        complex_case = 'word [] [literal] {something} {some:other thing} w{ord} w{or}d w{ord} w{o:rd} w{o:r}d {w:or}d w[]ord {posargs:{a key}}'
        p = CommandParser(complex_case)
        parsed = list(p.words())
        expected = [
            'word', ' ', '[]', ' ', '[literal]', ' ', '{something}', ' ', '{some:other thing}',
            ' ', 'w', '{ord}', ' ', 'w', '{or}', 'd', ' ', 'w', '{ord}', ' ', 'w', '{o:rd}', ' ', 'w', '{o:r}', 'd', ' ', '{w:or}', 'd',
            ' ', 'w[]ord', ' ', '{posargs:{a key}}',
            ]

        assert parsed == expected
Exemplo n.º 4
0
    def test_command_parser_with_complex_word_set(self):
        complex_case = 'word [] [literal] {something} {some:other thing} w{ord} w{or}d w{ord} w{o:rd} w{o:r}d {w:or}d w[]ord {posargs:{a key}}'
        p = CommandParser(complex_case)
        parsed = list(p.words())
        expected = [
            'word',
            ' ',
            '[]',
            ' ',
            '[literal]',
            ' ',
            '{something}',
            ' ',
            '{some:other thing}',
            ' ',
            'w',
            '{ord}',
            ' ',
            'w',
            '{or}',
            'd',
            ' ',
            'w',
            '{ord}',
            ' ',
            'w',
            '{o:rd}',
            ' ',
            'w',
            '{o:r}',
            'd',
            ' ',
            '{w:or}',
            'd',
            ' ',
            'w[]ord',
            ' ',
            '{posargs:{a key}}',
        ]

        assert parsed == expected
Exemplo n.º 5
0
 def test_command_with_runs_of_whitespace(self):
     cmd = "cmd1 {item1}\n  {item2}"
     p = CommandParser(cmd)
     parsed = list(p.words())
     assert parsed == ['cmd1', ' ', '{item1}', '\n  ', '{item2}']
Exemplo n.º 6
0
 def test_command_parser_for_substitution_with_spaces(self):
     p = CommandParser('{sub:something with spaces}')
     assert list(p.words()) == ['{sub:something with spaces}']
Exemplo n.º 7
0
 def test_command_parser_for_multiple_words(self):
     p = CommandParser('w1 w2 w3 ')
     assert list(p.words()) == ['w1', ' ', 'w2', ' ', 'w3']
Exemplo n.º 8
0
 def test_command_parser_for_posargs(self):
     p = CommandParser('[]')
     assert list(p.words()) == ['[]']
Exemplo n.º 9
0
 def test_command_parser_for_word(self):
     p = CommandParser('word')
     # import pytest; pytest.set_trace()
     assert list(p.words()) == ['word']
Exemplo n.º 10
0
 def test_command_parsing_for_issue_10(self):
     cmd = "nosetests -v -a !deferred --with-doctest []"
     p = CommandParser(cmd)
     parsed = list(p.words())
     assert parsed == ['nosetests', ' ', '-v', ' ', '-a', ' ', '!deferred', ' ', '--with-doctest', ' ', '[]']
Exemplo n.º 11
0
 def test_command_with_split_line_in_subst_arguments(self):
     cmd = dedent(""" cmd2 {posargs:{item2}
                      other}""")
     p = CommandParser(cmd)
     parsed = list(p.words())
     assert parsed == ['cmd2', ' ', '{posargs:{item2}\n                        other}']
Exemplo n.º 12
0
 def test_command_with_runs_of_whitespace(self):
     cmd = dedent("""cmd1 {item1}
                  {item2}""")
     p = CommandParser(cmd)
     parsed = list(p.words())
     assert parsed == ['cmd1', ' ', '{item1}', ' ', '{item2}']
Exemplo n.º 13
0
 def test_command_parser_for_substitution_with_spaces(self):
     p = CommandParser('{sub:something with spaces}')
     assert list(p.words()) == ['{sub:something with spaces}']
Exemplo n.º 14
0
 def test_command_parser_for_multiple_words(self):
     p = CommandParser('w1 w2 w3 ')
     assert list(p.words()) == ['w1', ' ', 'w2', ' ', 'w3']
Exemplo n.º 15
0
 def test_command_parser_for_posargs(self):
     p = CommandParser('[]')
     assert list(p.words()) == ['[]']
Exemplo n.º 16
0
 def test_command_parser_for_word(self):
     p = CommandParser('word')
     # import pytest; pytest.set_trace()
     assert list(p.words()) == ['word']