コード例 #1
0
def test_same_subject(cid1=id_,
                      cid2=id_,
                      s1=id_,
                      s2=id_,
                      ann=id_,
                      v1=coref_value,
                      v2=coref_value,
                      t1=time_value,
                      t2=time_value):
    l1 = Label(cid1,
               cid2,
               ann,
               v1,
               epoch_ticks=t1,
               subtopic_id1=s1,
               subtopic_id2=s2)
    l2 = Label(cid1,
               cid2,
               ann,
               v2,
               epoch_ticks=t2,
               subtopic_id1=s1,
               subtopic_id2=s2)
    assert l1.same_subject_as(l2)
    assert l2.same_subject_as(l1)
コード例 #2
0
ファイル: test_label.py プロジェクト: dossier/dossier.label
def test_same_subject(cid1=id_, cid2=id_, s1=id_, s2=id_, ann=id_,
                      v1=coref_value, v2=coref_value,
                      t1=time_value, t2=time_value):
    l1 = Label(cid1, cid2, ann, v1, epoch_ticks=t1,
               subtopic_id1=s1, subtopic_id2=s2)
    l2 = Label(cid1, cid2, ann, v2, epoch_ticks=t2,
               subtopic_id1=s1, subtopic_id2=s2)
    assert l1.same_subject_as(l2)
    assert l2.same_subject_as(l1)
コード例 #3
0
 def _(cid1a=id_,
       cid1b=id_,
       ann1=id_,
       v1=coref_value,
       t1=time_value,
       cid2a=id_,
       cid2b=id_,
       ann2=id_,
       v2=coref_value,
       t2=time_value):
     label_store.delete_all()
     l1 = Label(cid1a, cid1b, ann1, v1, epoch_ticks=t1)
     l2 = Label(cid2a, cid2b, ann2, v2, epoch_ticks=t2)
     label_store.put(l1)
     label_store.put(l2)
     if l1.same_subject_as(l2):
         if l1.epoch_ticks == l2.epoch_ticks:
             expected = [l2]
         else:
             expected = list(sorted([l1, l2]))[0:1]
     elif cid1a == cid2a or cid1a == cid2b:
         expected = list(sorted([l1, l2]))
     else:
         expected = [l1]
     assert (list(label_store.everything(content_id=cid1a)) == expected)
コード例 #4
0
 def _(cid1a=id_, cid1b=id_, ann1=id_, v1=coref_value, t1=time_value,
       cid2a=id_, cid2b=id_, ann2=id_, v2=coref_value, t2=time_value):
     label_store.delete_all()
     l1 = Label(cid1a, cid1b, ann1, v1, epoch_ticks=t1)
     l2 = Label(cid2a, cid2b, ann2, v2, epoch_ticks=t2)
     label_store.put(l1)
     label_store.put(l2)
     if l1.same_subject_as(l2) and l1.epoch_ticks == l2.epoch_ticks:
         expected = [l2]
     else:
         expected = list(sorted([l1, l2]))
     assert (list(label_store.everything(include_deleted=True)) ==
             expected)
コード例 #5
0
 def _(cid1a=id_, cid1b=id_, ann1=id_, v1=coref_value, t1=time_value,
       cid2a=id_, cid2b=id_, ann2=id_, v2=coref_value, t2=time_value):
     label_store.delete_all()
     l1 = Label(cid1a, cid1b, ann1, v1, epoch_ticks=t1)
     l2 = Label(cid2a, cid2b, ann2, v2, epoch_ticks=t2)
     label_store.put(l1)
     label_store.put(l2)
     if l1.same_subject_as(l2) and l1.epoch_ticks == l2.epoch_ticks:
         expected = [l2]
     else:
         expected = list(sorted([l1, l2]))
     assert (list(label_store.everything(include_deleted=True)) ==
             expected)
コード例 #6
0
 def _(cid1a=id_, cid1b=id_, ann1=id_, v1=coref_value, t1=time_value,
       cid2a=id_, cid2b=id_, ann2=id_, v2=coref_value, t2=time_value):
     label_store.delete_all()
     l1 = Label(cid1a, cid1b, ann1, v1, epoch_ticks=t1)
     l2 = Label(cid2a, cid2b, ann2, v2, epoch_ticks=t2)
     label_store.put(l1)
     label_store.put(l2)
     if l1.same_subject_as(l2):
         if l1.epoch_ticks == l2.epoch_ticks:
             expected = [l2]
         else:
             expected = list(sorted([l1, l2]))[0:1]
     elif cid1a == cid2a or cid1a == cid2b:
         expected = list(sorted([l1, l2]))
     else:
         expected = [l1]
     assert (list(label_store.everything(content_id=cid1a)) == expected)