Пример #1
0
def test_new(content):
    ann = Annotation(**content)

    assert ann.type == content["type"]
    assert ann.value == content["value"]
    assert ann.source == content["source"]
    assert ann.source_ID == content["source_ID"]
    assert ann.span == content["span"]
    assert ann.attributes == content["attributes"]
    assert ann.isEntity == content["isEntity"]
    assert ann.ID == content["ID"]
    assert ann.ngram == content["ngram"]
Пример #2
0
def test_to_json(content):

    ann = Annotation(**content)
    ann_json = ann.to_json()

    ann_json == json.dumps(content)
Пример #3
0
def test_to_dict(content):

    ann = Annotation(**content)
    ann_dict = ann.to_dict()

    assert ann_dict == content
Пример #4
0
 def test_init_missing_source_ID(self, content):
     with pytest.raises(TypeError):
         ann = Annotation(type=content["type"],
                          value=content["value"],
                          source=content["source"])
Пример #5
0
 def test_init_empty(self):
     with pytest.raises(TypeError):
         ann = Annotation()