test write predictions to streams
@@ -5965,3 +5965,47 @@ def test_train_on_quantized_pool_with_large_grid():
'-i', '10')
yatest.common.execute(cmd)
+
+def test_write_predictions_to_streams():
+ output_model_path = yatest.common.test_output_path('model.bin')
+ output_eval_path = yatest.common.test_output_path('test.eval')
+ calc_output_eval_path_redirected = yatest.common.test_output_path('calc_test.eval')
+
+ cmd = (
+ CATBOOST_PATH,
+ 'fit',
+ '-f', data_file('adult', 'train_small'),
+ '-t', data_file('adult', 'test_small'),
+ '--eval-file', output_eval_path,
+ '--column-description', data_file('adult', 'train.cd'),
+ '-i', '10',
+ '-m', output_model_path
+ )
+ yatest.common.execute(cmd)
+
+ calc_cmd = (
+ CATBOOST_PATH,
+ 'calc',
+ '--input-path', data_file('adult', 'test_small'),
+ '--column-description', data_file('adult', 'train.cd'),
+ '-m', output_model_path,
+ '--output-path', 'stream://stdout',
+ '>', calc_output_eval_path_redirected
+ )
+ yatest.common.execute(calc_cmd)
+
+ assert filecmp.cmp(output_eval_path, calc_output_eval_path_redirected)
+
+ calc_cmd = (
+ CATBOOST_PATH,
+ 'calc',
+ '--input-path', data_file('adult', 'test_small'),
+ '--column-description', data_file('adult', 'train.cd'),
+ '-m', output_model_path,
+ '--output-path', 'stream://stderr',
+ '2>', calc_output_eval_path_redirected
+ )
+ yatest.common.execute(calc_cmd)
+
+ assert filecmp.cmp(output_eval_path, calc_output_eval_path_redirected)
+
\ No newline at end of file
