Exemplo n.º 1
0
    def test_asserts_query_multiple(self):
        """ Show that setting the evidence with distinct objects yields
            distinct results """
        r = DataObject(key='relationship')
        ar = DataObject(key='aref')
        br = DataObject(key='bref')

        e = self.ctx.Evidence(key="a", reference=ar)
        e.supports(r)
        self.save()

        e1 = self.ctx.Evidence(key="b", reference=br)
        e1.supports(r)
        self.save()

        e0 = Evidence()
        e0.supports(r)
        for x in e0.load():
            lar = x.reference.one()
            lbr = x.reference.one()
            # Testing that either a has a result [email protected] and y has nothing or
            # y has a result 1999 and a has nothing
            if x.idl == e1.idl:
                self.assertEqual(lbr, br)
            elif x.idl == e.idl:
                self.assertEqual(lar, ar)
            else:
                self.fail("Unknown object returned from load")
Exemplo n.º 2
0
    def test_asserts_query_multiple(self):
        """ Show that setting the evidence with distinct objects yields
            distinct results """
        r = DataObject(key='relationship')

        e = Evidence(key="a", author='*****@*****.**')
        e.asserts(r)
        e.save()

        e1 = Evidence(key="b", year=1999)
        e1.asserts(r)
        e1.save()

        e0 = Evidence()
        e0.asserts(r)
        for x in e0.load():
            a = x.author.one()
            y = x.year()
            # Testing that either a has a result [email protected] and y has nothing or
            # y has a result 1999 and a has nothing
            if x.idl == e1.idl:
                self.assertEqual(y, 1999)
            elif x.idl == e.idl:
                self.assertEqual(a, '*****@*****.**')
            else:
                self.fail("Unknown object returned from load")
Exemplo n.º 3
0
    def test_multiple_evidence_for_single_fact(self):
        """
        Can we assert the same fact with two distinct pieces of Evidence?
        """

        e1 = Evidence()
        e1.pmid('777')

        e2 = Evidence()
        e2.pmid('888')

        c = DataObject(key=23)
        e1.asserts(c)
        e2.asserts(c)

        e1.save()
        e2.save()

        evs = Evidence()
        evs.asserts(c)

        saved_pmids = set(['777', '888'])
        loaded_pmids = set([x.pmid() for x in evs.load()])

        self.assertTrue(saved_pmids.issubset(loaded_pmids))
Exemplo n.º 4
0
    def test_asserts_query_multiple(self):
        """ Show that setting the evidence with distinct objects yields
            distinct results """
        r = DataObject(key='relationship')

        e = Evidence(key="a", author='*****@*****.**')
        e.asserts(r)
        e.save()

        e1 = Evidence(key="b", year=1999)
        e1.asserts(r)
        e1.save()

        e0 = Evidence()
        e0.asserts(r)
        for x in e0.load():
            a = x.author.one()
            y = x.year()
            # Testing that either a has a result [email protected] and y has nothing or
            # y has a result 1999 and a has nothing
            if x.idl == e1.idl:
                self.assertEqual(y, 1999)
            elif x.idl == e.idl:
                self.assertEqual(a, '*****@*****.**')
            else:
                self.fail("Unknown object returned from load")
Exemplo n.º 5
0
    def test_asserts_query_multiple(self):
        """ Show that setting the evidence with distinct objects yields
            distinct results """
        r = DataObject(key='relationship')
        ar = DataObject(key='aref')
        br = DataObject(key='bref')

        e = self.ctx.Evidence(key="a", reference=ar)
        e.supports(r)
        self.save()

        e1 = self.ctx.Evidence(key="b", reference=br)
        e1.supports(r)
        self.save()

        e0 = Evidence()
        e0.supports(r)
        for x in e0.load():
            lar = x.reference.one()
            lbr = x.reference.one()
            # Testing that either a has a result [email protected] and y has nothing or
            # y has a result 1999 and a has nothing
            if x.idl == e1.idl:
                self.assertEqual(lbr, br)
            elif x.idl == e.idl:
                self.assertEqual(lar, ar)
            else:
                self.fail("Unknown object returned from load")
Exemplo n.º 6
0
    def test_multiple_evidence_for_single_fact(self):
        """
        Can we assert the same fact with two distinct pieces of Evidence?
        """

        e1 = Evidence()
        e1.pmid('777')

        e2 = Evidence()
        e2.pmid('888')

        c = DataObject(key=23)
        e1.asserts(c)
        e2.asserts(c)

        e1.save()
        e2.save()

        evs = Evidence()
        evs.asserts(c)

        saved_pmids = set(['777', '888'])
        loaded_pmids = set([x.pmid() for x in evs.load()])

        self.assertTrue(saved_pmids.issubset(loaded_pmids))
Exemplo n.º 7
0
 def test_1(self):
     import bibtex
     bt = bibtex.parse("my.bib")
     n1 = Neuron("AVAL")
     n2 = Neuron("DA3")
     c = Connection(pre_cell=n1, post_cell=n2, synclass="synapse")
     e = Evidence(bibtex=bt['white86'])
     e.asserts(c)
     print(list(e.load()))
Exemplo n.º 8
0
 def test_1(self):
     import bibtex
     bt = bibtex.parse("my.bib")
     n1 = Neuron("AVAL")
     n2 = Neuron("DA3")
     c = Connection(pre_cell=n1, post_cell=n2, synclass="synapse")
     e = Evidence(bibtex=bt['white86'])
     e.asserts(c)
     print(list(e.load()))
Exemplo n.º 9
0
 def test_asserts_query(self):
     """ Show that we can store the evidence on an object and later retrieve it """
     e = Evidence(key="a", author='*****@*****.**')
     r = DataObject(key="relationship")
     e.asserts(r)
     e.save()
     e0 = Evidence()
     e0.asserts(r)
     s = list(e0.load())
     author = s[0].author.one()
     self.assertIn('*****@*****.**', author)
Exemplo n.º 10
0
 def test_asserts_query(self):
     """ Show that we can store the evidence on an object and later retrieve it """
     e = Evidence(key="a", author='*****@*****.**')
     r = DataObject(key="relationship")
     e.asserts(r)
     e.save()
     e0 = Evidence()
     e0.asserts(r)
     s = list(e0.load())
     author = s[0].author.one()
     self.assertIn('*****@*****.**', author)
Exemplo n.º 11
0
    def test_get_evidence(self):
        # Reference two neurons
        n1 = Neuron(name='AVAL')
        n2 = Neuron(name='PVCR')

        # Declare a connection between them
        c = Connection(n1, n2, number=1)
        e = Evidence()
        # Create an Evidence search-object
        e.asserts(c)

        # look for all of the evidence for the connection 'c'
        for x in e.load():
            print(x.author())
Exemplo n.º 12
0
    def test_get_evidence(self):
        # Reference two neurons
        n1 = Neuron(name='AVAL')
        n2 = Neuron(name='PVCR')

        # Declare a connection between them
        c = Connection(n1, n2, number=1)
        e = Evidence()
        # Create an Evidence search-object
        e.asserts(c)

        # look for all of the evidence for the connection 'c'
        for x in e.load():
            print (x.author())
Exemplo n.º 13
0
    def test_asserts_query_multiple_author_matches(self):
        """ Show that setting the evidence with distinct objects yields
        distinct results even if there are matching values """
        e = Evidence(key="k", author='*****@*****.**')
        r = DataObject(key="a_statement")
        e.asserts(r)
        e.save()

        e1 = Evidence(key="j", author='*****@*****.**')
        e1.asserts(r)
        e1.save()

        e0 = Evidence()
        e0.asserts(r)
        self.assertEqual(2, len(list(e0.load())))
Exemplo n.º 14
0
    def test_asserts_query_multiple_author_matches(self):
        """ Show that setting the evidence with distinct objects yields
        distinct results even if there are matching values """
        e = Evidence(key="k", author='*****@*****.**')
        r = DataObject(key="a_statement")
        e.asserts(r)
        e.save()

        e1 = Evidence(key="j", author='*****@*****.**')
        e1.asserts(r)
        e1.save()

        e0 = Evidence()
        e0.asserts(r)
        self.assertEqual(2, len(list(e0.load())))