Skip to content

Commit 83a2872

Browse files
committed
Made unit test more correct
1 parent 47dce29 commit 83a2872

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/test_parsing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import cmd2
1313
from cmd2 import constants, utils
1414
from cmd2.constants import MULTILINE_TERMINATOR
15-
from cmd2.parsing import StatementParser
15+
from cmd2.parsing import StatementParser, shlex_split
1616

1717
@pytest.fixture
1818
def parser():
@@ -210,7 +210,7 @@ def test_parse_embedded_comment_char(parser):
210210
assert statement.command == 'hi'
211211
assert statement == constants.COMMENT_CHAR + ' not a comment'
212212
assert statement.args == statement
213-
assert statement.argv == command_str.split()
213+
assert statement.argv == shlex_split(command_str)
214214
assert statement.arg_list == statement.argv[1:]
215215

216216
@pytest.mark.parametrize('line',[
@@ -478,9 +478,10 @@ def test_parse_alias_and_shortcut_expansion(parser, line, command, args):
478478
assert statement.args == statement
479479

480480
# Now allow no expansion
481+
tokens = shlex_split(line)
481482
statement = parser.parse(line, expand=False)
482-
assert statement.command == line.split()[0]
483-
assert statement.split() == line.split()[1:]
483+
assert statement.command == tokens[0]
484+
assert shlex_split(statement) == tokens[1:]
484485
assert statement.args == statement
485486

486487
def test_parse_alias_on_multiline_command(parser):

0 commit comments

Comments
 (0)