コード例 #1
0
 def test_assignment(self):
     doc = sbol.Document()
     md = doc.moduleDefinitions.create('foo')
     m1 = sbol.Module('m1')
     m2 = sbol.Module('m2')
     md.modules = [m1, m2]
     self.assertEqual(list(md.modules), [m1, m2])
コード例 #2
0
 def test_compare_owned_objects(self):
     # Test that two objects are equal even if owned objects are in
     # a different order
     expected1 = [sbol2.Module('m1'), sbol2.Module('m2')]
     expected2 = [sbol2.Module('m2'), sbol2.Module('m1')]
     md1 = sbol2.ModuleDefinition('md1')
     md1.modules = expected1
     md2 = sbol2.ModuleDefinition('md1')
     md2.modules = expected2
     self.assertTrue(md1.compare(md2))
コード例 #3
0
    def moduleModuleDefiniton(self):
        module_name_pref = self.obj_uri.split("/")[-1]
        module_name_suf = self.cell_val.split("/")[-1]
        mod1 = sbol2.Module(f"{module_name_pref}_{module_name_suf}")
        mod1.definition = self.cell_val

        self.obj.modules.add(mod1)
コード例 #4
0
 def test_set_no_doc(self):
     # Add a module when the parent module definition is not in a
     # Document
     md = sbol.ModuleDefinition('foo')
     m1 = sbol.Module('m1')
     md.modules.set([m1])
     self.assertEqual(m1, md.modules.get(0))
     self.assertEqual(m1, md.modules.find(m1.identity))
コード例 #5
0
 def build_md_tree_3(self, suffix='1'):
     # Build a md->m->measurement tree for comparison
     meter_uri = 'http://www.ontology-of-units-of-measure.org/resource/om-2/metre'
     mdef = sbol2.ModuleDefinition('md' + suffix)
     module = sbol2.Module('m' + suffix)
     measurement = sbol2.Measurement('meas' + suffix, 5.0, meter_uri)
     module.measurements = [measurement]
     mdef.modules = [module]
     return mdef
コード例 #6
0
 def test_containers(self):
     # Note: Alphabetical Order
     x = sbol.Activity()
     x = sbol.CombinatorialDerivation()
     x = sbol.Component()
     x = sbol.ComponentDefinition()
     x = sbol.Document()
     x = sbol.Interaction()
     x = sbol.Module()
     x = sbol.ModuleDefinition()
     x = sbol.Participation()
     x = sbol.SequenceAnnotation()
コード例 #7
0
    def test_compare_recursive(self):
        # Test that the compare method is doing a recursive compare
        m1a = sbol2.Module('m1')
        m1b = sbol2.Module('m1')
        # m1a and m1b compare True
        self.assertTrue(m1a.compare(m1b))
        m2 = sbol2.Module('m2')
        # m2 is different from m1a and m1b
        self.assertFalse(m2.compare(m1a))
        self.assertFalse(m2.compare(m1b))

        md1a = sbol2.ModuleDefinition('md1')
        md1b = sbol2.ModuleDefinition('md1')
        # md1a and md1b compare True
        self.assertTrue(md1a.compare(md1b))
        md1a.modules = [m1a]
        md1b.modules = [m1b]
        # md1a and md1b still compare True
        self.assertTrue(md1a.compare(md1b))
        md1a.modules = [m2]
        # Now md1a and md1b compare False because of recursive
        # comparison of modules
        self.assertFalse(md1a.compare(md1b))