Ejemplo n.º 1
0
        "fields": (
            "id",
            "image",
            "grader",
            "created",
            "name",
            "singlepolygonannotation_set",
        ),
    },
    "single_polygon": {
        "unique": True,
        "factory": SinglePolygonAnnotationFactory,
        "serializer": SinglePolygonAnnotationSerializer,
        "fields": ("id", "value", "annotation_set", "created"),
    },
    "landmark": {
        "unique": True,
        "factory": LandmarkAnnotationSetFactory,
        "serializer": LandmarkAnnotationSetSerializer,
        "fields": ("id", "grader", "created", "singlelandmarkannotation_set"),
    },
    "single_landmark": {
        "unique": True,
        "factory": SingleLandmarkAnnotationFactory,
        "serializer": SingleLandmarkAnnotationSerializer,
        "fields": ("image", "annotation_set", "landmarks"),
    },
}

batch_test_serializers(serializers, TestAnnotationSerializers)
import pytest
from tests.registrations_tests.factories import OctObsRegistrationFactory
from grandchallenge.registrations.serializers import (
    OctObsRegistrationSerializer, )
from tests.serializer_helpers import batch_test_serializers


@pytest.mark.django_db
class TestRegistrationSerializers:
    # test methods are added dynamically to this class, see below
    pass


serializers = {
    "octobsregistration": {
        "unique": True,
        "factory": OctObsRegistrationFactory,
        "serializer": OctObsRegistrationSerializer,
        "fields": ("obs_image", "oct_image", "registration_values"),
    }
}

batch_test_serializers(serializers, TestRegistrationSerializers)
Ejemplo n.º 3
0
    def test_image_serializer_valid(self):
        assert check_if_valid(ImageFactoryWithImageFile(), ImageSerializer)


serializers = {
    "image": {
        "unique": True,
        "factory": ImageFactoryWithImageFile,
        "serializer": ImageSerializer,
        "fields": (
            "pk",
            "name",
            "study",
            "files",
            "width",
            "height",
            "depth",
            "color_space",
            "modality",
            "eye_choice",
            "stereoscopic_choice",
            "field_of_view",
            "shape_without_color",
            "shape",
        ),
        "no_valid_check": True,  # This check is done manually because of the need to skip the image in the check
    }
}

batch_test_serializers(serializers, TestRetinaImageSerializers)
import pytest
from tests.archives_tests.factories import ArchiveFactory
from grandchallenge.archives.serializers import ArchiveSerializer
from tests.serializer_helpers import batch_test_serializers


@pytest.mark.django_db
class TestArchivesSerializers:
    pass


serializers = {
    "archive": {
        "unique": True,
        "factory": ArchiveFactory,
        "serializer": ArchiveSerializer,
        "fields": ("id", "name", "images"),
    }
}

batch_test_serializers(serializers, TestArchivesSerializers)
import pytest
from tests.serializer_helpers import batch_test_serializers
from tests.studies_tests.factories import StudyFactory
from grandchallenge.studies.serializers import StudySerializer


@pytest.mark.django_db
class TestStudiesSerializers:
    pass


serializers = {
    "study": {
        "unique": True,
        "factory": StudyFactory,
        "serializer": StudySerializer,
        "fields": ("id", "name", "datetime", "patient"),
    }
}

batch_test_serializers(serializers, TestStudiesSerializers)
Ejemplo n.º 6
0
        "fields": (
            "id",
            "image",
            "grader",
            "created",
            "name",
            "singlepolygonannotation_set",
        ),
    },
    "single_polygon": {
        "unique": True,
        "factory": SinglePolygonAnnotationFactory,
        "serializer": SinglePolygonAnnotationSerializer,
        "fields": ("id", "value", "annotation_set"),
    },
    "landmark": {
        "unique": True,
        "factory": LandmarkAnnotationSetFactory,
        "serializer": LandmarkAnnotationSetSerializer,
        "fields": ("id", "grader", "created", "singlelandmarkannotation_set"),
    },
    "single_landmark": {
        "unique": True,
        "factory": SingleLandmarkAnnotationFactory,
        "serializer": SingleLandmarkAnnotationSerializer,
        "fields": ("image", "annotation_set", "landmarks"),
    },
}

batch_test_serializers(serializers, TestAnnotationSerializers)
Ejemplo n.º 7
0
serializers = {
    "image": {
        "unique":
        True,
        "factory":
        ImageFactoryWithImageFile,
        "serializer":
        ImageSerializer,
        "fields": (
            "pk",
            "name",
            "study",
            "files",
            "width",
            "height",
            "depth",
            "color_space",
            "modality",
            "eye_choice",
            "stereoscopic_choice",
            "field_of_view",
            "shape_without_color",
            "shape",
        ),
        "no_valid_check":
        True,  # This check is done manually because of the need to skip the image in the check
    }
}

batch_test_serializers(serializers, TestRetinaImageSerializers)
import pytest
from tests.serializer_helpers import batch_test_serializers
from grandchallenge.patients.serializers import PatientSerializer
from tests.patients_tests.factories import PatientFactory


@pytest.mark.django_db
class TestPatientsSerializers:
    pass


serializers = {
    "patient": {
        "unique": True,
        "factory": PatientFactory,
        "serializer": PatientSerializer,
        "fields": ("id", "name"),
    }
}

batch_test_serializers(serializers, TestPatientsSerializers)