def test_DSD_ComplexDomains(self): foo = bc.DSD_Complex(sequence= [self.d1, self.d2, self.d3, '+', self.d1, '+', self.d1c, self.d3c, self.d1c, self.d2], structure=list('..(+(+))..')) self.assertEqual(foo.sequence, [self.d1, self.d2, self.d3, '+', self.d1, '+', self.d1c, self.d3c, self.d1c, self.d2]) self.assertEqual(foo.lol_sequence, [[self.d1, self.d2, self.d3], [self.d1], [self.d1c, self.d3c, self.d1c, self.d2]]) bc.clear_memory() bar = bc.DSD_Complex(sequence= [self.d1c, self.d3c, self.d1c, self.d2, '+', self.d1, self.d2, self.d3, '+', self.d1], structure=list('((..+..)+)')) self.assertEqual(foo, bar) self.assertTrue(foo == bar)
def test_initialize(self): with self.assertRaises(bc.DSDObjectsError): x = bc.DSD_Reaction(['A','B','C'],['D','A','E'], rtype = 'branch-3way') A = bc.DSD_Complex(list('NNNNNNN'), list('((...))'), name='A') B = bc.DSD_Complex(list('NNNNNNN'), list('.(...).'), name='B') x = bc.DSD_Reaction([A, B],[B, B], rtype = 'branch-3way') with self.assertRaises(bc.DSDDuplicationError): y = bc.DSD_Reaction([A, B],[B, B], rtype = 'branch-3way') bc.clear_memory() y = bc.DSD_Reaction([A, B],[B, B], rtype = 'branch-3way', rate=.5) z = bc.DSD_Reaction([A],[B], rtype='bind11') self.assertEqual('A + B -> B + B', str(x)) A.name = 'Z' self.assertEqual('Z + B -> B + B', str(x)) self.assertEqual('Z + B -> B + B', str(y)) self.assertEqual(x, y) with self.assertRaises(bc.DSDDuplicationError): y = bc.DSD_Reaction([A, B],[B, B], rtype = 'branch-3way') self.assertEqual(x, y) self.assertTrue(x != z) self.assertEqual(y.rate.constant, .5) self.assertEqual(y.const, .5) self.assertEqual(y.rateunits, '/M/s') x = y.rateformat(['M','s']) self.assertEqual(x.constant, 0.5) x = y.rateformat(['mM','s']) self.assertEqual(x.constant, 0.0005) x = y.rateformat(['uM','s']) self.assertEqual(x.constant, 0.0000005) x = y.rateformat(['nM','s']) self.assertEqual(x.constant, 0.0000000005) x = y.rateformat(['pM','s']) self.assertEqual(x.constant, 0.0000000000005) y.rate = y.rateformat(['mM','s']) self.assertEqual(y.rate.constant, 0.0005)
def tearDown(self): bc.clear_memory()