Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b87aaf2

Browse files
naterushCarreau
authored andcommitted
utils/tests: move to pytest.mark.parameterize in test_process.py
1 parent 3a78d13 commit b87aaf2

1 file changed

Lines changed: 23 additions & 25 deletions

File tree

IPython/utils/tests/test_process.py

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,35 +56,33 @@ def test_find_cmd_fail():
5656
pytest.raises(FindCmdError, find_cmd, "asdfasdf")
5757

5858

59-
# TODO: move to pytest.mark.parametrize once nose gone
6059
@dec.skip_win32
61-
def test_arg_split():
60+
@pytest.mark.parametrize('argstr, argv', [
61+
('hi', ['hi']),
62+
(u'hi', [u'hi']),
63+
('hello there', ['hello', 'there']),
64+
# \u01ce == \N{LATIN SMALL LETTER A WITH CARON}
65+
# Do not use \N because the tests crash with syntax error in
66+
# some cases, for example windows python2.6.
67+
(u'h\u01cello', [u'h\u01cello']),
68+
('something "with quotes"', ['something', '"with quotes"']),
69+
])
70+
def test_arg_split(argstr, argv):
6271
"""Ensure that argument lines are correctly split like in a shell."""
63-
tests = [['hi', ['hi']],
64-
[u'hi', [u'hi']],
65-
['hello there', ['hello', 'there']],
66-
# \u01ce == \N{LATIN SMALL LETTER A WITH CARON}
67-
# Do not use \N because the tests crash with syntax error in
68-
# some cases, for example windows python2.6.
69-
[u'h\u01cello', [u'h\u01cello']],
70-
['something "with quotes"', ['something', '"with quotes"']],
71-
]
72-
for argstr, argv in tests:
73-
assert arg_split(argstr) == argv
74-
75-
76-
# TODO: move to pytest.mark.parametrize once nose gone
72+
assert arg_split(argstr) == argv
73+
74+
7775
@dec.skip_if_not_win32
78-
def test_arg_split_win32():
76+
@pytest.mark.parametrize('argstr,argv', [
77+
('hi', ['hi']),
78+
(u'hi', [u'hi']),
79+
('hello there', ['hello', 'there']),
80+
(u'h\u01cello', [u'h\u01cello']),
81+
('something "with quotes"', ['something', 'with quotes']),
82+
])
83+
def test_arg_split_win32(argstr, argv):
7984
"""Ensure that argument lines are correctly split like in a shell."""
80-
tests = [['hi', ['hi']],
81-
[u'hi', [u'hi']],
82-
['hello there', ['hello', 'there']],
83-
[u'h\u01cello', [u'h\u01cello']],
84-
['something "with quotes"', ['something', 'with quotes']],
85-
]
86-
for argstr, argv in tests:
87-
assert arg_split(argstr) == argv
85+
assert arg_split(argstr) == argv
8886

8987

9088
class SubProcessTestCase(tt.TempFileMixin):

0 commit comments

Comments
 (0)