def test_init(self): with self.assertRaises(ValueError): pronto.Xref("PMC SOMETHING") if __debug__: with self.assertRaises(TypeError): pronto.Xref(1) with self.assertRaises(TypeError): pronto.Xref("PMC:5392374", 1)
def test_term_definition_as_axiom(self): ont = self.get_ontology(""" <owl:Ontology/> <owl:Class rdf:about="http://purl.obolibrary.org/obo/TST_001"> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">a term</obo:IAO_0000115> <oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">TST:001</oboInOwl:id> </owl:Class> <owl:Axiom> <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/TST_001"/> <owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/> <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">a term</owl:annotatedTarget> <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ISBN:1234</oboInOwl:hasDbXref> </owl:Axiom> """) self.assertIn("TST:001", ont) self.assertEqual(ont["TST:001"].definition, "a term") self.assertEqual( list(ont["TST:001"].definition.xrefs)[0], pronto.Xref("ISBN:1234"))
def test_term_synonym_as_axiom(self): with warnings.catch_warnings(): warnings.simplefilter("ignore", pronto.warnings.SyntaxWarning) ont = self.get_ontology(""" <owl:Ontology/> <owl:Class rdf:about="http://purl.obolibrary.org/obo/TST_001"> <oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">stuff</oboInOwl:hasExactSynonym> <oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">TST:001</oboInOwl:id> </owl:Class> <owl:Axiom> <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/TST_001"/> <owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasExactSynonym"/> <owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">stuff</owl:annotatedTarget> <oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ISBN:1234</oboInOwl:hasDbXref> </owl:Axiom> """) self.assertIn("TST:001", ont) self.assertEqual(len(ont["TST:001"].synonyms), 1) syn = next(iter(ont["TST:001"].synonyms)) self.assertEqual(syn.description, "stuff") self.assertEqual(syn.scope, "EXACT") self.assertEqual(syn.xrefs, {pronto.Xref("ISBN:1234")})
def test_repr(self): x1 = pronto.Xref("PMC:5392374") self.assertEqual(repr(x1), "Xref('PMC:5392374')")
def setUp(self): self.x1 = pronto.Xref("PMC:5392374") self.x2 = pronto.Xref("PMC:5392374") self.x3 = pronto.Xref("PMC:5706746")
def test_repr(self): d1 = pronto.Definition("something") self.assertEqual(repr(d1), "Definition('something')") d2 = pronto.Definition("something", xrefs={pronto.Xref("Bgee:fbb")}) self.assertEqual(repr(d2), "Definition('something', xrefs={Xref('Bgee:fbb')})")