from indra.statements import *

def test_matches():
    ras = Agent('Ras')
    raf = Agent('Raf')
    st1 = Complex([ras, raf])
    st2 = Complex([ras, raf])
    assert(st1.matches(st2))

def test_matches2():
    ras = Agent('Raf')
    raf = Agent('Mek')
    st1 = Phosphorylate(raf, mek, 'Phosphorylation', None)
    st2 = Phosphorylate(raf, mek, 'Phosphorylation', None)
    assert(st1.matches(st2))
    
def test_not_matches():
    ras = Agent('Raf')
    raf = Agent('Mek')
    st1 = Phosphorylate(raf, mek, 'Phosphorylation', None)
    st2 = Phosphorylate(raf, mek, 'PhosphorylationTyrosine', None)
    assert(not st1.matches(st2))

def test_matches_dbrefs():
    hras1 = Agent('HRAS', db_refs={'hgnc': 1111})
    hras2 = Agent('HRAS', db_refs={'hgnc': 9999})
    assert(hras1.matches(hras2))

def test_matches_bound():
    hras1 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('BRAF'), True)])
    hras2 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('BRAF'), True)])
    assert(hras1.matches(hras2))

def test_not_matches_bound():
    hras1 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('BRAF', True))])
    hras2 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('RAF1', True))])
    assert(not hras1.matches(hras2))

def test_not_matches_bound2():
    hras1 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('BRAF', True))])
    hras2 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('BRAF', False))])
    assert(not hras1.matches(hras2))

def test_matches_bound_multiple():
    hras1 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('BRAF'), True),
        BoundCondition(Agent('RAF1', True))])
    hras2 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('BRAF'), True)])
        BoundCondition(Agent('RAF1', True))])
    assert(hras1.matches(hras2))

def test_matches_bound_multiple_order():
    hras1 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('RAF1'), True),
        BoundCondition(Agent('BRAF', True))])
    hras2 = Agent('HRAS', 
        bound_conditions=[BoundCondition(Agent('BRAF'), True)])
        BoundCondition(Agent('RAF1', True))])
    assert(hras1 == hras2)

Add tests for Preassembler