Example #1
0
    def test_call_without_optional_input_args(self, mocker, mocks_init_class,
                                              test_data):
        mock_run = mocker.patch.object(AddAPI, "run")

        add(test_data['dataset'], test_data['task'], test_data['data_dir'],
            test_data['hdf5_filename'])

        assert_mock_call(mocks_init_class)
        assert mock_run.called
Example #2
0
    def test_call_with_all_input_args(self, mocker, mocks_init_class,
                                      test_data):
        mock_run = mocker.patch.object(AddAPI, "run")

        add(test_data['dataset'], test_data['task'], test_data['data_dir'],
            test_data['hdf5_filename'], test_data['categories'],
            test_data['verbose'], test_data['force_overwrite'])

        assert_mock_call(mocks_init_class)
        assert mock_run.called
Example #3
0
 def test_call__raises_error_extra_inputs(self, mocker):
     with pytest.raises(TypeError):
         add("db", "task", "data dir", "filename", [], False, False,
             'extra field')
Example #4
0
 def test_call__raises_error_no_inputs(self, mocker):
     with pytest.raises(TypeError):
         add("db", "task", "data dir")