added new annotation types
This commit is contained in:
@@ -23,10 +23,13 @@ from data_store.repositories import (
|
||||
)
|
||||
from data_store.dto import (
|
||||
Annotation,
|
||||
DistanceEnum,
|
||||
AngleEnum,
|
||||
PointOfViewEnum,
|
||||
ColourEnum,
|
||||
ContactEnum,
|
||||
DepthEnum,
|
||||
DistanceEnum,
|
||||
LightingEnum,
|
||||
PointOfViewEnum,
|
||||
Job,
|
||||
)
|
||||
|
||||
@@ -114,35 +117,35 @@ def job_id_list() -> Generator[list[UUID]]:
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def csv_data_file(
|
||||
job_id_list: list[UUID],
|
||||
) -> Generator[Path]:
|
||||
"""Create a CSV data file for testing."""
|
||||
# Create csv content
|
||||
csv_data = pd.DataFrame(
|
||||
{
|
||||
"job_id": job_id_list,
|
||||
"distance": [
|
||||
"close",
|
||||
"long",
|
||||
"wrong",
|
||||
],
|
||||
"angle": ["high", "low", "wrong"],
|
||||
"point_of_view": ["frontal", "oblique", "wrong"],
|
||||
"contact": ["offer", "demand", "wrong"],
|
||||
}
|
||||
)
|
||||
# Create data directory and file path
|
||||
data_dir = Path(tempfile.mkdtemp())
|
||||
data_path = data_dir / "annotations.csv"
|
||||
# Write CSV content to file
|
||||
csv_data.to_csv(data_path, header=True, index=False)
|
||||
# @pytest.fixture(scope="session")
|
||||
# def csv_data_file(
|
||||
# job_id_list: list[UUID],
|
||||
# ) -> Generator[Path]:
|
||||
# """Create a CSV data file for testing."""
|
||||
# # Create csv content
|
||||
# csv_data = pd.DataFrame(
|
||||
# {
|
||||
# "job_id": job_id_list,
|
||||
# "distance": [
|
||||
# "close",
|
||||
# "long",
|
||||
# "wrong",
|
||||
# ],
|
||||
# "angle": ["high", "low", "wrong"],
|
||||
# "point_of_view": ["frontal", "oblique", "wrong"],
|
||||
# "contact": ["offer", "demand", "wrong"],
|
||||
# }
|
||||
# )
|
||||
# # Create data directory and file path
|
||||
# data_dir = Path(tempfile.mkdtemp())
|
||||
# data_path = data_dir / "annotations.csv"
|
||||
# # Write CSV content to file
|
||||
# csv_data.to_csv(data_path, header=True, index=False)
|
||||
|
||||
yield data_path
|
||||
# yield data_path
|
||||
|
||||
# Cleanup
|
||||
shutil.rmtree(data_dir)
|
||||
# # Cleanup
|
||||
# shutil.rmtree(data_dir)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
@@ -245,10 +248,20 @@ def annotation_repository() -> Generator[AnnotationRepository]:
|
||||
def annotation() -> Generator[Annotation]:
|
||||
"""Provide a sample annotation for testing."""
|
||||
annotation = Annotation(
|
||||
distance=DistanceEnum.CLOSE,
|
||||
angle=AngleEnum.HIGH,
|
||||
point_of_view=PointOfViewEnum.FRONTAL,
|
||||
angle_uncertainty=True,
|
||||
colour=ColourEnum.HIGH,
|
||||
colour_uncertainty=False,
|
||||
contact=ContactEnum.OFFER,
|
||||
contact_uncertainty=True,
|
||||
depth=DepthEnum.LOW,
|
||||
depth_uncertainty=False,
|
||||
distance=DistanceEnum.CLOSE,
|
||||
distance_uncertainty=True,
|
||||
lighting=LightingEnum.MEDIUM,
|
||||
lighting_uncertainty=False,
|
||||
point_of_view=PointOfViewEnum.FRONTAL,
|
||||
point_of_view_uncertainty=True,
|
||||
)
|
||||
yield annotation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user