Пример #1
0
def test_list_images_less_than_count():
    """Unit test for method list_images, less than counter case."""
    expected_length = -1

    image_database = ImageDatabase(
        import_images=True,
        data_dir=TEST_DIRECTORY
    )

    actual_result = [*image_database.list_images(top=expected_length)]

    assert len(actual_result) == 0
Пример #2
0
def test_list_images():
    """Unit test for method list_images."""
    expected_result = abspath('tests/test_database/0/0.jpg')

    image_database = ImageDatabase(
        import_images=True,
        data_dir=TEST_DIRECTORY
    )

    actual_result = [*image_database.list_images()][0]

    assert expected_result == actual_result
Пример #3
0
def test_list_images_return_index():
    """Unit test for method list_images, return index case."""
    expected_path = abspath('tests/test_database/0/0.jpg')
    expected_index = 0
    expected_result = (expected_index, expected_path)

    image_database = ImageDatabase(
        import_images=True,
        data_dir=TEST_DIRECTORY
    )

    actual_index_path = [
        *image_database.list_images(
            return_index=True
        )
    ][0]

    assert actual_index_path == expected_result