@pytest.mark.parametrize('call,args', [('scrape', ['http://www.google.com/']), ('analyze', [['安全性能很好，很帅气。'], ['categories', 'concepts']])])
@pytest.mark.parametrize('count,call_count', [(0, 0), (5, 0), (9, 0), (10, 1), (11, 1), (19, 1), (20, 2)])
def test_should_start_analysis(api, mocker, call, args, count, call_count):
    writer = writers.DataFrameWriter()
    writer.init()
    to_mock = ('anacode.api.client.AnacodeClient.' + call)
    mock.patch(to_mock, empty_json)
    analyzer = client.Analyzer(api, writer, bulk_size=10)
    mocker.spy(analyzer, 'execute_tasks_and_store_output')
    for _ in range(count):
        getattr(analyzer, call)(*args)
    assert (analyzer.execute_tasks_and_store_output.call_count == call_count)
@pytest.mark.parametrize('call,args', [('scrape', ['http://www.google.com/']), ('analyze', [['安全性能很好，很帅气。'], ['categories', 'concepts']])])
@pytest.mark.parametrize('count,call_count', [(0, 0), (5, 0), (9, 0), (10, 1), (11, 1), (19, 1), (20, 2)])
def test_should_start_analysis(api, mocker, call, args, count, call_count):
    writer = writers.DataFrameWriter()
    writer.init()
    to_mock = ('anacode.api.client.AnacodeClient.' + call)
    mock.patch(to_mock, empty_json)
    analyzer = client.Analyzer(api, writer, bulk_size=10)
    mocker.spy(analyzer, 'execute_tasks_and_store_output')
    for _ in range(count):
        getattr(analyzer, call)(*args)
    assert (analyzer.execute_tasks_and_store_output.call_count == call_count)