Example #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', ' ', '[]'
     ]
Example #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}'
     ]
Example #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
Example #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
Example #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}']
Example #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}']
Example #7
0
 def test_command_parser_for_multiple_words(self):
     p = CommandParser('w1 w2 w3 ')
     assert list(p.words()) == ['w1', ' ', 'w2', ' ', 'w3']
Example #8
0
 def test_command_parser_for_posargs(self):
     p = CommandParser('[]')
     assert list(p.words()) == ['[]']
Example #9
0
 def test_command_parser_for_word(self):
     p = CommandParser('word')
     # import pytest; pytest.set_trace()
     assert list(p.words()) == ['word']
Example #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', ' ', '[]']
Example #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}']
Example #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}']
Example #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}']
Example #14
0
 def test_command_parser_for_multiple_words(self):
     p = CommandParser('w1 w2 w3 ')
     assert list(p.words()) == ['w1', ' ', 'w2', ' ', 'w3']
Example #15
0
 def test_command_parser_for_posargs(self):
     p = CommandParser('[]')
     assert list(p.words()) == ['[]']
Example #16
0
 def test_command_parser_for_word(self):
     p = CommandParser('word')
     # import pytest; pytest.set_trace()
     assert list(p.words()) == ['word']