from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.statements import Agent
from indra.databases import chembl_client
from indra.util import unicode_strs

vem = Agent('VEMURAFENIB', db_refs={'CHEBI': '63637', 'TEXT': 'VEMURAFENIB'})
braf = Agent('BRAF', db_refs={'HGNC': '1097', 'NCIT': 'C51194',
                              'TEXT': 'BRAF', 'UP': 'P15056'})

def test_get_inhibitions():
    stmt = chembl_client.get_inhibition(vem, braf)
    assert(stmt is not None)
    assert(unicode_strs(stmt))
    assert(len(stmt.evidence) > 5)
    for ev in stmt.evidence:
        assert(ev.pmid)
        assert(ev.annotations)
        assert(ev.source_api == 'chembl')
        assert(ev.source_id)


def test_get_all_protein_activities_vem():
    stmts = chembl_client.get_all_protein_activities(vem)
    assert(stmts is not None)
    for st in stmts:
        assert(unicode_strs(st))
        assert(len(st.evidence) >= 1)
        for ev in st.evidence:
            assert(ev.pmid)
            assert(ev.annotations)
            assert(ev.source_api == 'chembl')
            assert(ev.source_id)



@@ -289,16 +289,67 @@
 ENIB'%7D)%0A
+az628 = Agent('AZ628', db_refs=%7B'CHEBI': '91354'%7D)%0A
 braf = A
@@ -1177,28 +1177,428 @@
      assert(ev.source_id)%0A%0A%0A
+def test_get_all_protein_activities_az628():%0A    stmts = chembl_client.get_all_protein_activities(az628)%0A    assert(stmts is not None)%0A    for st in stmts:%0A        assert(unicode_strs(st))%0A        assert(len(st.evidence) %3E= 1)%0A        for ev in st.evidence:%0A            assert(ev.pmid)%0A            assert(ev.annotations)%0A            assert(ev.source_api == 'chembl')%0A            assert(ev.source_id)%0A

Test get_all_protein_activities for AZ628