def test_has_clashes(self): f1 = ModernaFragment(self.s1) clashes = f1.has_clashes(list(self.s2)) self.assertEqual(len(clashes), 8) struc = ModernaStructure('file', FRAGMENT1) clashes = f1.has_clashes(list(struc)) self.assertEqual(len(clashes), 0)
def test_attributes(self): """object attributes should have been set up correctly.""" f1 = ModernaFragment(self.s1) f2 = ModernaFragment(self.s2, new_sequence=Sequence('GCLG')) modfrag = ModernaFragment(self.s3, new_sequence=Sequence('GL7L7L7ULL7L7AG')) self.assertEqual(len(modfrag.struc), 15) self.assertEqual(f1.struc.get_sequence(),Sequence("GCGG")) self.assertEqual(f2.struc.get_sequence(),Sequence("GCGG")) self.assertTrue(str(f1))
def test_apply_sequence_modified(self): """Applying a sequence with modifications should work.""" f2 = ModernaFragment(self.s2, new_sequence=Sequence('GCLG')) f2.apply_seq() self.assertEqual(self.s2.get_sequence(),Sequence("GCLG")) modfrag = ModernaFragment(self.s3, new_sequence=Sequence('GL7L7L7ULL7L7AG')) modfrag.apply_seq() self.assertEqual(self.s3.get_sequence(), Sequence('GL7L7L7ULL7L7AG'))
def test_apply_sequence(self): """Should change the sequence of the entire fragment.""" frag = ModernaFragment(self.s1, new_sequence=Sequence('AAAA')) frag.apply_seq() self.assertEqual(self.s1.get_sequence(), Sequence('AAAA')) # test lengths that do not fit frag = ModernaFragment(self.s2, new_sequence=Sequence('AAA')) self.assertRaises(ModernaFragmentError, frag.apply_seq) frag = ModernaFragment(self.s2, new_sequence=Sequence('AAAAA')) self.assertRaises(ModernaFragmentError, frag.apply_seq)
def test_init(self): """Should have ModernaStructure as an attribute.""" f1 = ModernaFragment(self.s1) self.assertEqual(f1.struc.get_sequence(), Sequence('GCGG'))
def test_abstract_methods(self): """Some placeholder methods should be there.""" f1 = ModernaFragment(self.s1) f1.get_resi_to_remove(self.s2) f1.fix_backbone()
def test_renumber(self): """Should exist as an abstract method.""" f1 = ModernaFragment(self.s1) f1.renumber() self.assertEqual([r.identifier for r in self.s1], ['1A', '1B', '1C', '1D'])
def test_prepare_anchor_residues(self): """Should exist as an abstract method.""" f1 = ModernaFragment(self.s1) self.assertRaises(ModernaSuperimposerError, f1.prepare_anchor_residues)
def test_superimpose(self): """Should just exist as an abstract method.""" f1 = ModernaFragment(self.s1) self.assertRaises(ModernaSuperimposerError, f1.superimpose)
def test_nonanchor_residues(self): """Stems defined in subclasses, thus should return all residues.""" f1 = ModernaFragment(self.s1) self.assertEqual(len(f1.nonanchor_residues), 4)
def test_anchor_residues(self): """Abstract superclass should have no anchors yet.""" f1 = ModernaFragment(self.s1) self.assertEqual(f1.anchor_residues, [])