Tests

Documentation on pytest tests.

Main

test_FindSimilarTo(value: str, expected: Tuple[str])

Test flask image recommendation api.

Parameters
  • filename (str) – filename of source image.

  • expected (List[str]) – expected recommendations. Every element must be recommended to pass.

SQLManagement

test_SQLManagement_formatDateTime(value: str, expected: str)

Test that EXIF datetime is translated into python compatible datetime format.

Parameters
  • value (str) – datetime string to convert.

  • expected (str) – datetime string result.

test_SQLManagement_getAllRows()

SQLManagement creates database using all images in PATH_IMAGES_RAW. Thus, getAllRows should return a list with the same length as the number of images in PATH_IMAGES_RAW.

test_SQLManagement_getRowsWithValue_IntegerTest(value: str, column: str, strict: bool)

Test that all rows returned actually contain value. If strict, columns must contain exact value. Else, column contains value as substring.

Matches are casted to int to verify that they are truly integers.

Parameters
  • value (str) – value to search in database.

  • column (str) – column to search in database.

  • strict (bool) – should do strict search.

test_SQLManagement_getRowsWithValue_StringTest(value: str, column: str, strict: bool)

Test that all rows returned actually contain value. If strict, columns must contain exact value. Else, column contains value as substring.

Parameters
  • value (str) – value to search in database.

  • column (str) – column to search in database.

  • strict (bool) – should do strict search.

Img2VecResnet18

test_Img2VecResnet18_getSimilarImages(filename: str, expected: List[str])

Test that recommended images are similar to source.

Parameters
  • filename (str) – filename of source image.

  • expected (List[str]) – expected recommendations. Every element must be recommended to pass.