예제 #1
0
def test_validator_good():
    """
    A fake test to establish a success condition for validation.
    """
    G = NxGraph()
    G.add_node('UniProtKB:P123456',
               id='UniProtKB:P123456',
               name='fake',
               category=['Protein'])
    G.add_node('UBERON:0000001',
               id='UBERON:0000001',
               name='fake',
               category=['NamedThing'])
    G.add_node('UBERON:0000002',
               id='UBERON:0000002',
               name='fake',
               category=['NamedThing'])
    G.add_edge(
        'UBERON:0000001',
        'UBERON:0000002',
        id='UBERON:0000001-part_of-UBERON:0000002',
        relation='RO:1',
        predicate='part_of',
        subject='UBERON:0000001',
        object='UBERON:0000002',
        category=['biolink:Association'],
    )
    validator = Validator(verbose=True)
    e = validator.validate(G)
    print(validator.report(e))
    assert len(e) == 0
예제 #2
0
def test_validate_edge_properties(query):
    """
    Test validate_edge_properties in Validator.
    """
    required_properties = Validator.get_required_edge_properties()
    e = Validator.validate_edge_properties(query[0], query[1], query[2], required_properties)
    print(Validator.report(e))
    assert (len(e) == 0) == query[3]