def test_init(self): with self.assertRaises(ValueError): prom = pt.BindingSite("promoter", -1, 10, dict()) with self.assertRaises(ValueError): site = pt.BindingSite("promoter", -1, -10, dict()) with self.assertRaises(ValueError): site = pt.BindingSite("promoter", 1, -10, dict()) with self.assertRaises(ValueError): site = pt.BindingSite("promoter", 1, 10, {"rnapol": -2}) with self.assertRaises(ValueError): site = pt.BindingSite("promoter", 1, 10, { "rnapol": -2, "ecolipol": 1})
def test_coverings(self): site = pt.BindingSite("promoter", 1, 10, {"rnapol": 1.0}) self.assertFalse(site.was_covered()) self.assertFalse(site.is_covered()) self.assertFalse(site.was_uncovered()) site.cover() self.assertTrue(site.is_covered()) self.assertTrue(site.was_covered()) self.assertFalse(site.was_uncovered()) site.reset_state() self.assertTrue(site.is_covered()) self.assertFalse(site.was_covered()) self.assertFalse(site.was_uncovered()) site.uncover() self.assertFalse(site.is_covered()) self.assertFalse(site.was_covered()) self.assertTrue(site.was_uncovered()) site.reset_state() self.assertFalse(site.is_covered()) self.assertFalse(site.was_covered()) self.assertFalse(site.was_uncovered())
def test_clone(self): # Clone should create explicit copy site = pt.BindingSite("promoter", 1, 10, {"rnapol": 1.0}) new_site = site.clone() self.assertNotEqual(site, new_site) site.cover() self.assertTrue(site.is_covered()) self.assertFalse(new_site.is_covered())
def test_exposure(self): # This is really just testing if the bindings are set up correctly site = pt.BindingSite("promoter", 1, 10, {"rnapol": 1.0}) self.assertFalse(site.first_exposure) site.first_exposure = True self.assertTrue(site.first_exposure)
def test_interaction(self): site = pt.BindingSite("promoter", 1, 10, {"rnapol": 1.0}) self.assertTrue(site.check_interaction("rnapol")) self.assertFalse(site.check_interaction("otherpol"))