Skip to content

Commit

Permalink
feat(sex): Use Sex
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikstranneheim committed May 16, 2024
1 parent 0750658 commit 8a98147
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions tests/mocks/scout.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
"""Mock the scout api"""

import logging
from mock import Mock

from mock import Mock
from pydantic.v1 import BaseModel, validator
from typing_extensions import Literal

from cg.apps.scout.scoutapi import ScoutAPI
from cg.constants.subject import Sex
from tests.mocks.process_mock import ProcessMock

LOG = logging.getLogger(__name__)


class MockScoutIndividual(BaseModel):
sample_id: str = "sample_id"
sex: str = "female"
sex: str = Sex.FEMALE
analysis_type: Literal[
"external",
"mixed",
Expand Down
2 changes: 1 addition & 1 deletion tests/models/mip/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def mip_metrics_deliverables_raw() -> dict:
"input": "some_input",
"name": "gender",
"step": "chanjo_sexcheck",
"value": "female",
"value": Sex.FEMALE,
},
{
"id": "another_id",
Expand Down
3 changes: 2 additions & 1 deletion tests/models/mip/test_mip_metrics_deliverables.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test MIP metrics deliverables"""

from cg.constants.subject import Sex
from cg.models.mip.mip_metrics_deliverables import (
DuplicateReads,
MeanInsertSize,
Expand Down Expand Up @@ -163,7 +164,7 @@ def test_instantiate_mip_metrics_set_sample_id_metrics(mip_metrics_deliverables_
assert sample_id_metric.mapped_reads_step == "bamstats"
assert sample_id_metric.mean_insert_size == 422.0
assert sample_id_metric.mean_insert_size_step == "collectmultiplemetricsinsertsize"
assert sample_id_metric.predicted_sex == "female"
assert sample_id_metric.predicted_sex == Sex.FEMALE
assert sample_id_metric.predicted_sex_step == "chanjo_sexcheck"


Expand Down
2 changes: 1 addition & 1 deletion tests/models/report/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def test_get_gender_as_string():
validated_invalid_gender: str = get_gender_as_string(invalid_gender)

# THEN check if the gender has been correctly formatted
assert validated_gender == REPORT_GENDER.get("female")
assert validated_gender == REPORT_GENDER.get(Sex.FEMALE)
assert validated_invalid_gender == NA_FIELD


Expand Down
2 changes: 1 addition & 1 deletion tests/store/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class StoreConstants(enum.Enum):
REFERENCE_GENOME_SAMPLE_WITH_ATTRIBUTES: str = "NC_222"
ORIGINAL_TICKET_SAMPLE_WITH_ATTRIBUTES: str = "ticket"
FROM_SAMPLE_SAMPLE_WITH_ATTRIBUTES: str = "sample_1"
SEX_SAMPLE_WITH_ATTRIBUTES: str = "male"
SEX_SAMPLE_WITH_ATTRIBUTES: str = Sex.MALE
ENTRY_ID_SAMPLE_WITH_ATTRIBUTES: int = 1
INVOICE_ID_SAMPLE_WITH_ATTRIBUTES: int = 1
INTERNAL_ID_SAMPLE_WITHOUT_ATTRIBUTES: str = "sample_without_attributes"
Expand Down

0 comments on commit 8a98147

Please sign in to comment.