Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Changed validation checks to begin>=0 instead of begin>0 #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_annotator_output(annotation_list=None):
assert len(annotation.id) > 0
if annotation.type is not None:
assert len(annotation.type) > 0
assert annotation.begin > 0
assert annotation.begin >= 0
assert annotation.end > annotation.begin
assert annotation.covered_text is not None
if annotation.uid is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_concept_annotation(annotation_list=None):
assert len(annotation.id) > 0
if annotation.type is not None:
assert len(annotation.type) > 0
assert annotation.begin > 0
assert annotation.begin >= 0
assert annotation.end > annotation.begin
assert annotation.covered_text is not None
if annotation.semantic_type is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_nlu_entities(annotation_list=None):
for annotation in annotation_list:
assert annotation.type is not None
assert annotation.source is not None
assert annotation.begin > 0
assert annotation.begin >= 0
assert annotation.end > annotation.begin
assert annotation.relevance > 0
if annotation.uid is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ def test_section_annotation(annotation_list=None):
assert annotation.type is not None
if annotation.section_type is not None:
assert len(annotation.section_type) > 0
assert annotation.begin > 0
assert annotation.begin >= 0
assert annotation.end > annotation.begin
if annotation.covered_text is not None:
assert len(annotation.covered_text) > 0
if annotation.trigger is not None:
section_trigger = annotation.trigger
assert section_trigger.begin > 0
assert section_trigger.begin >= 0
assert section_trigger.end > section_trigger.begin
assert section_trigger.covered_text is not None
assert section_trigger.source is not None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestSpellCorrectionAnnotation(object):
def test_spelling_correction(annotation_list=None):
if annotation_list is not None:
for annotation in annotation_list:
assert annotation.begin > 0
assert annotation.begin >= 0
assert annotation.end > annotation.begin
assert annotation.covered_text is not None
for suggestion in annotation.suggestions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from ibm_whcs_sdk.annotator_for_clinical_data.tests.common import test_section
from ibm_cloud_sdk_core.authenticators.no_auth_authenticator import NoAuthAuthenticator
import inspect
import io
Expand Down Expand Up @@ -2478,6 +2479,15 @@ def test_unstructured_container_serialization(self):
unstructured_container_model_json2 = unstructured_container_model.to_dict()
# assert unstructured_container_model_json2 == unstructured_container_model_json

#-----------------------------------------------------------------------------
# Test Class for Section
#-----------------------------------------------------------------------------
class TestSection():
def test_section_validation(self):
# Construct a basic Annotation and make sure it passes sanity test
annotation_model = Section(begin=0, end=1, type='testType')
test_section.TestSectionAnnotation.test_section_annotation(annotation_list=[annotation_model])

#-----------------------------------------------------------------------------
# Test Class for ServiceError
#-----------------------------------------------------------------------------
Expand Down