Exemplo n.º 1
0
 def test_add(self):
     sbol3.set_namespace('https://github.com/synbiodex/pysbol3')
     doc = sbol3.Document()
     non_top_level = sbol3.Interface()
     with self.assertRaises(TypeError):
         doc.add(non_top_level)
     seq = sbol3.Sequence('seq1')
     doc.add(seq)
     seq2 = doc.find(seq.identity)
     self.assertEqual(seq.identity, seq2.identity)
Exemplo n.º 2
0
 def test_type_validation(self):
     # Test the validation of types on owned object properties by
     # going behind the scenes to set a bad value
     sbol3.set_namespace('https://github.com/synbiodex/pysbol3')
     c1 = sbol3.Component('c1', sbol3.SBO_DNA)
     report = c1.validate()
     self.assertEqual(0, len(report))
     c1._owned_objects[sbol3.SBOL_FEATURES] = [
         sbol3.Interface(), sbol3.Implementation('i1')
     ]
     report = c1.validate()
     # Expecting 2 errors, one for each inappropriate value
     self.assertEqual(2, len(report))
Exemplo n.º 3
0
 def test_add(self):
     sbol3.set_namespace('https://github.com/synbiodex/pysbol3')
     doc = sbol3.Document()
     non_top_level = sbol3.Interface()
     with self.assertRaises(TypeError):
         doc.add(non_top_level)
     seq = sbol3.Sequence('seq1')
     added_seq = doc.add(seq)
     # Document.add should return the object
     # See https://github.com/SynBioDex/pySBOL3/issues/272
     self.assertEqual(seq, added_seq)
     seq2 = doc.find(seq.identity)
     self.assertEqual(seq.identity, seq2.identity)
Exemplo n.º 4
0
 def test_create(self):
     interface = sbol3.Interface()
     self.assertIsNotNone(interface)
     self.assertEqual(sbol3.SBOL_INTERFACE, interface.type_uri)