Ejemplo n.º 1
0
def test_plot_learning_curves_create_output_directory():
    summary_file_name = join(_my_dir, 'other',
                             'sample_learning_curve_summary.tsv')
    output_dir_name = join(_my_dir, 'other', 'foobar')
    plc_cmd_args = [summary_file_name, output_dir_name]
    plc.main(argv=plc_cmd_args)
    exists(output_dir_name)
Ejemplo n.º 2
0
def test_plot_learning_curves_argparse():
    # A utility function to check that we are setting up argument parsing
    # correctly for plot_learning_curves. We are not checking whether the learning
    # curves produced are accurate because we have separate tests for that.

    # replace the _generate_learning_curve_plots function that's called
    # by the main() in plot_learning_curves with a mocked up version
    generate_learning_curve_plots_mock = create_autospec(
        _generate_learning_curve_plots)
    plc._generate_learning_curve_plots = generate_learning_curve_plots_mock

    # now call main with some arguments
    summary_file_name = join(_my_dir, 'other',
                             'sample_learning_curve_summary.tsv')
    experiment_name = 'sample_learning_curve'
    output_dir_name = join(_my_dir, 'other')
    plc_cmd_args = [summary_file_name, output_dir_name]
    plc.main(argv=plc_cmd_args)

    # now check to make sure that _generate_learning_curve_plots (or our mocked up version
    # of it) got the arguments that we passed
    positional_arguments, keyword_arguments = generate_learning_curve_plots_mock.call_args
    eq_(positional_arguments[0], experiment_name)
    eq_(positional_arguments[1], output_dir_name)
    eq_(positional_arguments[2], summary_file_name)
Ejemplo n.º 3
0
def test_plot_learning_curves_missing_file():
    summary_file_name = join(_my_dir, 'other', 'non_existent_summary.tsv')
    output_dir_name = join(_my_dir, 'other')
    plc_cmd_args = [summary_file_name, output_dir_name]
    plc.main(argv=plc_cmd_args)
Ejemplo n.º 4
0
def test_plot_learning_curves_no_pandas_no_seaborn():
    summary_file_name = join(_my_dir, 'other', 'sample_learning_curve_summary.tsv')
    output_dir_name = join(_my_dir, 'other')
    plc_cmd_args = [summary_file_name, output_dir_name]
    plc.main(argv=plc_cmd_args)