def test_run_squad(self):
    stream_handler = logging.StreamHandler(sys.stdout)
    logger.addHandler(stream_handler)
    testargs = ['run_squad.py', '--data_dir=./examples/tests_samples/SQUAD', '--model_name=bert-base-uncased', '--output_dir=./examples/tests_samples/temp_dir', '--max_steps=10', '--warmup_steps=2', '--do_train', '--do_eval', '--version_2_with_negative', '--learning_rate=2e-4', '--per_gpu_train_batch_size=2', '--per_gpu_eval_batch_size=1', '--overwrite_output_dir', '--seed=42']
    (model_type, model_name) = ('--model_type=bert', '--model_name_or_path=bert-base-uncased')
    with patch.object(sys, 'argv', (testargs + [model_type, model_name])):
        result = run_squad.score_challenges()
        self.assertGreaterEqual(result['f1'], 30)
        self.assertGreaterEqual(result['exact'], 30)
def test_run_squad(self):
    stream_handler = logging.StreamHandler(sys.stdout)
    logger.addHandler(stream_handler)
    testargs = ['run_squad.py', '--data_dir=./examples/tests_samples/SQUAD', '--model_name=bert-base-uncased', '--output_dir=./examples/tests_samples/temp_dir', '--max_steps=10', '--warmup_steps=2', '--do_train', '--do_eval', '--version_2_with_negative', '--learning_rate=2e-4', '--per_gpu_train_batch_size=2', '--per_gpu_eval_batch_size=1', '--overwrite_output_dir', '--seed=42']
    (model_type, model_name) = ('--model_type=bert', '--model_name_or_path=bert-base-uncased')
    with patch.object(sys, 'argv', (testargs + [model_type, model_name])):
        result = run_squad.score_challenges()
        self.assertGreaterEqual(result['f1'], 30)
        self.assertGreaterEqual(result['exact'], 30)