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 0870326 commit 0750658
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions tests/meta/report/test_mip_dna_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from cg.constants import REPORT_GENDER
from cg.constants.subject import Sex
from tests.store_helpers import StoreHelpers


Expand Down
10 changes: 5 additions & 5 deletions tests/meta/workflow/test_balsamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ def test_get_verified_sex():

# GIVEN a sample object
sample_obj = {
"ACC0000A0": {"sex": "female"},
"ACC0000A1": {"sex": "female"},
"ACC0000A0": {"sex": Sex.FEMALE},
"ACC0000A1": {"sex": Sex.FEMALE},
}

# WHEN extracting the sex
retrieved_sex: Sex = BalsamicAnalysisAPI.get_verified_sex(sample_obj)

# THEN sex must match the expected one
assert retrieved_sex == "female"
assert retrieved_sex == Sex.FEMALE


def test_get_verified_sex_error():
Expand All @@ -49,8 +49,8 @@ def test_get_verified_sex_unknown(caplog):

# GIVEN a sample object with different sexes
sample_obj = {
"ACC0000A0": {"sex": "unknown"},
"ACC0000A1": {"sex": "unknown"},
"ACC0000A0": {"sex": Sex.UNKNOWN},
"ACC0000A1": {"sex": Sex.UNKNOWN},
}

# WHEN extracting the sex
Expand Down
4 changes: 2 additions & 2 deletions tests/mocks/limsmock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing_extensions import Literal

from cg.apps.lims import LimsAPI
from cg.constants.subject import PhenotypeStatus
from cg.constants.subject import PhenotypeStatus, Sex


class LimsProject(BaseModel):
Expand All @@ -23,7 +23,7 @@ class LimsSample(BaseModel):
id: str
name: str = None
customer: str = None
sex: Literal["male", "female", "unknown"] = None
sex: Literal[Sex.MALE, Sex.FEMALE, Sex.UNKNOWN] = None
father: str = None
mother: str = None
status: Literal[
Expand Down
3 changes: 2 additions & 1 deletion tests/models/mip/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest

from cg.constants.priority import SlurmQos
from cg.constants.subject import Sex
from cg.models.mip.mip_metrics_deliverables import MIPMetricsDeliverables


Expand Down Expand Up @@ -165,7 +166,7 @@ def mip_metrics_deliverables_raw() -> dict:
"input": "some_input",
"name": "gender",
"step": "chanjo_sexcheck",
"value": "male",
"value": Sex.MALE,
},
{
"id": "an_id",
Expand Down

0 comments on commit 0750658

Please sign in to comment.