Skip to content

Commit

Permalink
request support sentence batch
Browse files Browse the repository at this point in the history
  • Loading branch information
liu946 committed Oct 23, 2017
1 parent 06a2566 commit 2c48d28
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/autotest/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def NormalTest():
optparser.add_option("--case", dest="error_cases", action="store_true",
default=False, help="specify case test")
optparser.add_option("--file", dest="filename", help="specify the file")
optparser.add_option("--sentence-batch", dest="stn_batch", help="stns in one request", default=1)
opts, args = optparser.parse_args()

if opts.error_cases:
Expand All @@ -112,8 +113,12 @@ def TEST(function, name):
print >> sys.stderr, "Failed to open file, use stdin instead"
fp=sys.stdin

buffer=[]
for line in fp:
try:
print Request(line.strip(), 'n')
buffer.append(line.strip())
if len(buffer) == opts.stn_batch:
print Request('\n'.join(buffer), 'n')
buffer=[]
except Exception, e:
print e

0 comments on commit 2c48d28

Please sign in to comment.