Skip to content

Commit 4b668a9

Browse files
author
Paul Felt
committed
fix: Changed validation checks to begin>=0 instead of begin>0
1 parent 7dd9e4b commit 4b668a9

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

ibm_whcs_sdk/annotator_for_clinical_data/tests/common/test_annotator_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_annotator_output(annotation_list=None):
2525
assert len(annotation.id) > 0
2626
if annotation.type is not None:
2727
assert len(annotation.type) > 0
28-
assert annotation.begin > 0
28+
assert annotation.begin >= 0
2929
assert annotation.end > annotation.begin
3030
assert annotation.covered_text is not None
3131
if annotation.uid is not None:

ibm_whcs_sdk/annotator_for_clinical_data/tests/common/test_concept_annotation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_concept_annotation(annotation_list=None):
2626
assert len(annotation.id) > 0
2727
if annotation.type is not None:
2828
assert len(annotation.type) > 0
29-
assert annotation.begin > 0
29+
assert annotation.begin >= 0
3030
assert annotation.end > annotation.begin
3131
assert annotation.covered_text is not None
3232
if annotation.semantic_type is not None:

ibm_whcs_sdk/annotator_for_clinical_data/tests/common/test_nlu_entities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_nlu_entities(annotation_list=None):
2222
for annotation in annotation_list:
2323
assert annotation.type is not None
2424
assert annotation.source is not None
25-
assert annotation.begin > 0
25+
assert annotation.begin >= 0
2626
assert annotation.end > annotation.begin
2727
assert annotation.relevance > 0
2828
if annotation.uid is not None:

ibm_whcs_sdk/annotator_for_clinical_data/tests/common/test_section.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ def test_section_annotation(annotation_list=None):
2323
assert annotation.type is not None
2424
if annotation.section_type is not None:
2525
assert len(annotation.section_type) > 0
26-
assert annotation.begin > 0
26+
assert annotation.begin >= 0
2727
assert annotation.end > annotation.begin
2828
if annotation.covered_text is not None:
2929
assert len(annotation.covered_text) > 0
3030
if annotation.trigger is not None:
3131
section_trigger = annotation.trigger
32-
assert section_trigger.begin > 0
32+
assert section_trigger.begin >= 0
3333
assert section_trigger.end > section_trigger.begin
3434
assert section_trigger.covered_text is not None
3535
assert section_trigger.source is not None

ibm_whcs_sdk/annotator_for_clinical_data/tests/common/test_spell_correction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TestSpellCorrectionAnnotation(object):
2222
def test_spelling_correction(annotation_list=None):
2323
if annotation_list is not None:
2424
for annotation in annotation_list:
25-
assert annotation.begin > 0
25+
assert annotation.begin >= 0
2626
assert annotation.end > annotation.begin
2727
assert annotation.covered_text is not None
2828
for suggestion in annotation.suggestions:

ibm_whcs_sdk/annotator_for_clinical_data/tests/unit/test_annotator_for_clinical_data_v1.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
from ibm_whcs_sdk.annotator_for_clinical_data.tests.common import test_section
1617
from ibm_cloud_sdk_core.authenticators.no_auth_authenticator import NoAuthAuthenticator
1718
import inspect
1819
import io
@@ -2478,6 +2479,15 @@ def test_unstructured_container_serialization(self):
24782479
unstructured_container_model_json2 = unstructured_container_model.to_dict()
24792480
# assert unstructured_container_model_json2 == unstructured_container_model_json
24802481

2482+
#-----------------------------------------------------------------------------
2483+
# Test Class for Section
2484+
#-----------------------------------------------------------------------------
2485+
class TestSection():
2486+
def test_section_validation(self):
2487+
# Construct a basic Annotation and make sure it passes sanity test
2488+
annotation_model = Section(begin=0, end=1, type='testType')
2489+
test_section.TestSectionAnnotation.test_section_annotation(annotation_list=[annotation_model])
2490+
24812491
#-----------------------------------------------------------------------------
24822492
# Test Class for ServiceError
24832493
#-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)