Skip to content

Commit

Permalink
Unit tests are passing for annotation_unit. Formatted and linted back…
Browse files Browse the repository at this point in the history
…end.
  • Loading branch information
fatimarabab committed May 8, 2024
1 parent 633d705 commit 3d1b9c2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions backend/src/core/annotation_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def should_continue_annotation(self):
missing_dependencies = self.get_missing_dependencies()
logger_message = '%s Canceling Annotation, Missing %s ...'

print("THIS IS THE MISSING DEPENDENCY")
print(str(missing_dependencies))
return missing_dependencies, logger_message

def increment_delay_count(self):
Expand Down
22 changes: 18 additions & 4 deletions backend/tests/unit/core/test_annotation_unit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for annotation unit class"""
from unittest.mock import Mock
import pytest

from src.core.annotation_unit import AnnotationUnit
Expand All @@ -9,15 +10,28 @@ def test_annotation_unit_gets_missing_dependencies(annotation_unit_lmna):
actual = annotation_unit_lmna.get_missing_dependencies()
assert actual == ['HGNC_ID']


def test_annotation_unit_ready_for_annotation(annotation_unit_lmna):
"""Verifies if the annotation unit is ready for annotation"""
actual = annotation_unit_lmna.ready_for_annotation()
assert actual == False

missing = annotation_unit_lmna.get_missing_dependencies()
missing_dependency = missing[0]
mock_genomic_unit_collection = Mock()
mock_genomic_unit_collection.find_genomic_unit_annotation_value = Mock()
annotation_value = mock_genomic_unit_collection.find_genomic_unit_annotation_value(
annotation_unit_lmna.genomic_unit, missing_dependency
)

actual = annotation_unit_lmna.ready_for_annotation(annotation_value, missing_dependency)
assert actual is True


def test_annotation_unit_should_continue_annotation(annotation_unit_lmna):
"""Verifies if the annotation unit should continue annotation"""
actual = annotation_unit_lmna.should_continue_annotation()
assert actual == ""
actual_missing_dependencies, actual_logger_message = annotation_unit_lmna.should_continue_annotation()
assert actual_missing_dependencies == ""
assert actual_logger_message == '%s Delaying Annotation, Missing Dependency...'


@pytest.fixture(name="annotation_unit_lmna")
def fixture_annotation_unit():
Expand Down

0 comments on commit 3d1b9c2

Please sign in to comment.