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