diff --git a/tests/api_workflow/test_api_workflow_upload_embeddings.py b/tests/api_workflow/test_api_workflow_upload_embeddings.py index 4444d11d7..a3bb54c2b 100644 --- a/tests/api_workflow/test_api_workflow_upload_embeddings.py +++ b/tests/api_workflow/test_api_workflow_upload_embeddings.py @@ -4,11 +4,7 @@ import numpy as np from lightly.utils import io as io_utils -from lightly.utils.io import INVALID_FILENAME_CHARACTERS -from tests.api_workflow.mocked_api_workflow_client import ( - N_FILES_ON_SERVER, - MockedApiWorkflowSetup, -) +from tests.api_workflow.mocked_api_workflow_client import MockedApiWorkflowSetup class TestApiWorkflowUploadEmbeddings(MockedApiWorkflowSetup): @@ -80,15 +76,6 @@ def test_upload_wrong_filenames(self): with self.assertRaises(ValueError): self.t_ester_upload_embedding(n_data=n_data, special_name_first_sample=True) - def test_upload_comma_filenames(self): - n_data = len(self.api_workflow_client._mappings_api.sample_names) - for invalid_char in INVALID_FILENAME_CHARACTERS: - with self.subTest(msg=f"invalid_char: {invalid_char}"): - with self.assertRaises(ValueError): - self.t_ester_upload_embedding( - n_data=n_data, special_char_in_first_filename=invalid_char - ) - def test_set_embedding_id_default(self): self.api_workflow_client.set_embedding_id_to_latest() embeddings = ( diff --git a/tests/data/test_LightlyDataset.py b/tests/data/test_LightlyDataset.py index c5a1a7c6c..0b4c7b196 100644 --- a/tests/data/test_LightlyDataset.py +++ b/tests/data/test_LightlyDataset.py @@ -1,23 +1,18 @@ import os -import random -import re import shutil import tempfile import unittest -import warnings from typing import List, Tuple import numpy as np -import torch import torchvision from PIL.Image import Image from lightly.data import LightlyDataset from lightly.data._utils import check_images -from lightly.utils.io import INVALID_FILENAME_CHARACTERS try: - import av + import av as _ import cv2 from lightly.data._video import VideoDataset @@ -137,24 +132,6 @@ def test_create_lightly_dataset_from_folder_nosubdir(self): for i in range(n_tot): sample, target, fname = dataset[i] - def test_create_lightly_dataset_with_invalid_char_in_filename(self): - # create a dataset - n_tot = 100 - dataset = torchvision.datasets.FakeData(size=n_tot, image_size=(3, 32, 32)) - - for invalid_char in INVALID_FILENAME_CHARACTERS: - with self.subTest(msg=f"invalid_char: {invalid_char}"): - tmp_dir = tempfile.mkdtemp() - sample_names = [f"img_,_{i}.jpg" for i in range(n_tot)] - for sample_idx in range(n_tot): - data = dataset[sample_idx] - path = os.path.join(tmp_dir, sample_names[sample_idx]) - data[0].save(path) - - # create lightly dataset - with self.assertRaises(ValueError): - dataset = LightlyDataset(input_dir=tmp_dir) - def test_check_images(self): # create a dataset tmp_dir = tempfile.mkdtemp()