Skip to content

Commit

Permalink
fix: fix the client cli parser
Browse files Browse the repository at this point in the history
  • Loading branch information
nan-wang committed Jun 2, 2020
1 parent f1acce3 commit 73d17ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jina/main/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 429,7 @@ def set_client_cli_parser(parser=None):
help='randomize the doc_id, if this is set then `first_request_id` is ignored')
gp1.add_argument('--timeout-ready', type=int, default=10000,
help='timeout (ms) of a pea is ready for request, -1 for waiting forever')
gp1.add_argument('--filter-by', type=str, action='append',
gp1.add_argument('--filter-by', type=str, nargs='*',
help='field names to query on')
return parser

Expand Down
18 changes: 18 additions & 0 deletions tests/test_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 1,18 @@
import unittest
from tests import JinaTestCase
from jina.main.parser import set_client_cli_parser
from jina.helper import get_parsed_args


class MyTestCase(JinaTestCase):
def test_get_parsed_args_parse_list(self):
kwargs = {'filter-by': ['a', 'b']}
parser = set_client_cli_parser()
args, p_args, un_args = get_parsed_args(kwargs, parser)
self.assertEqual(len(args), 3)
self.assertEqual(len(p_args.filter_by), 2)
self.assertEqual(len(un_args), 0)


if __name__ == '__main__':
unittest.main()

0 comments on commit 73d17ba

Please sign in to comment.