def assert_upload_mocks_are_correctly_called(remote_dataset: RemoteDataset, *args): with patch.object(UploadHandler, "_request_upload", return_value=([], [])) as request_upload_mock: with patch.object(UploadHandler, "upload") as upload_mock: remote_dataset.push(*args) request_upload_mock.assert_called_once() upload_mock.assert_called_once_with(multi_threaded=True, progress_callback=None, file_upload_callback=None)
def raises_if_both_as_frames_and_local_files_are_given( remote_dataset: RemoteDataset): with pytest.raises(ValueError): remote_dataset.push([LocalFile("test.jpg")], as_frames=True)
def raises_with_unsupported_files(remote_dataset: RemoteDataset): with pytest.raises(UnsupportedFileType): remote_dataset.push(["test.txt"])
def raises_if_files_are_not_provided(remote_dataset: RemoteDataset): with pytest.raises(ValueError): remote_dataset.push(None)