Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding test validating image download to default location #92

Merged
merged 1 commit into from
May 14, 2018
Merged

Adding test validating image download to default location #92

merged 1 commit into from
May 14, 2018

Conversation

amitaisopher
Copy link
Contributor

Hi hardikvasa!,

I noticed there are no tests to your project (which I like) so I decided to write some tests for it starting with this one. In this pull request I created a test to validate that the correct amount of files are downloaded to the default location.

Test logic:

  1. Creating an instance of google_images_download and add arguments dictionary.
  2. Making sure that "output_folder" is not in "arguments"
  3. Downloading arbitrary number of files (I choose 5)
  4. Counting the number of files that were downloaded while looking for them in the default location which is under downloads{searched keyword} relative to the location the script was executed from.
    5, Clean up after test finish by deleting the downloaded files.

So far I was able to write this test and meet the following guidelines:

  • Use only Python standard library modules.

  • Tests are OS agnostic due to using modules which are OS agnostic (Although I haven't had a Mac or Linux machine available to verify)

I am thinking about writing additional tests, however I would like to get some feedback from you so I could improve any future tests that I will write.

Cheers,
Amitai.

@hardikvasa
Copy link
Owner

hardikvasa commented May 14, 2018

@amitaisopher this is awesome! thanks for your PR. merging it.

it would be nice to also keep track of the directory it created and then delete the image directory as well in the cleaning process. Adding a function call at the end of the file test_download_images_to_default_location() would be helpful too. So users does not have to do that.

It would also be great to have additional tests which shows some image processing/augmentation with Pillow (PIL) after downloading the images. For e.g. download some images and convert all of them to b/w images. That would give a good use case to this lib.

I guess it is okay to have additional external libraries in the tests. I just wanted to keep the source code 3rd-party-library proof. :)

@hardikvasa hardikvasa merged commit 0f1b04c into hardikvasa:master May 14, 2018
SecorD0 pushed a commit to SecorD0/google-images-download that referenced this pull request Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants