Skip to content

Commit

Permalink
protein-translation: adjust assertion param order (exercism#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcfps committed Feb 20, 2018
1 parent 96027e1 commit 6071a7c
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions exercises/protein-translation/protein_translation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,62 @@
class ProteinTranslationTests(unittest.TestCase):

def test_AUG_translates_to_methionine(self):
self.assertEqual(['Methionine'], proteins('AUG'))
self.assertEqual(proteins('AUG'), ['Methionine'])

def test_identifies_Phenylalanine_codons(self):
for codon in ['UUU', 'UUC']:
self.assertEqual(['Phenylalanine'], proteins(codon))
self.assertEqual(proteins(codon), ['Phenylalanine'])

def test_identifies_Leucine_codons(self):
for codon in ['UUA', 'UUG']:
self.assertEqual(['Leucine'], proteins(codon))
self.assertEqual(proteins(codon), ['Leucine'])

def test_identifies_Serine_codons(self):
for codon in ['UCU', 'UCC', 'UCA', 'UCG']:
self.assertEqual(['Serine'], proteins(codon))
self.assertEqual(proteins(codon), ['Serine'])

def test_identifies_Tyrosine_codons(self):
for codon in ['UAU', 'UAC']:
self.assertEqual(['Tyrosine'], proteins(codon))
self.assertEqual(proteins(codon), ['Tyrosine'])

def test_identifies_Cysteine_codons(self):
for codon in ['UGU', 'UGC']:
self.assertEqual(['Cysteine'], proteins(codon))
self.assertEqual(proteins(codon), ['Cysteine'])

def test_identifies_Tryptophan_codons(self):
self.assertEqual(['Tryptophan'], proteins('UGG'))
self.assertEqual(proteins('UGG'), ['Tryptophan'])

def test_identifies_stop_codons(self):
for codon in ['UAA', 'UAG', 'UGA']:
self.assertEqual([], proteins(codon))
self.assertEqual(proteins(codon), [])

def test_translates_rna_strand_into_correct_protein_list(self):
strand = 'AUGUUUUGG'
expected = ['Methionine', 'Phenylalanine', 'Tryptophan']
self.assertEqual(expected, proteins(strand))
self.assertEqual(proteins(strand), expected)

def test_stops_translation_if_stop_codon_at_beginning_of_sequence(self):
strand = 'UAGUGG'
expected = []
self.assertEqual(expected, proteins(strand))
self.assertEqual(proteins(strand), expected)

def test_stops_translation_if_stop_codon_at_end_of_two_codon_sequence(
self):
strand = 'UGGUAG'
expected = ['Tryptophan']
self.assertEqual(expected, proteins(strand))
self.assertEqual(proteins(strand), expected)

def test_stops_translation_if_stop_codon_at_end_of_three_codon_sequence(
self):
strand = 'AUGUUUUAA'
expected = ['Methionine', 'Phenylalanine']
self.assertEqual(expected, proteins(strand))
self.assertEqual(proteins(strand), expected)

def test_stops_translation_if_stop_codon_in_middle_of_six_codon_sequence(
self):
strand = 'UGGUGUUAUUAAUGGUUU'
expected = ['Tryptophan', 'Cysteine', 'Tyrosine']
self.assertEqual(expected, proteins(strand))
self.assertEqual(proteins(strand), expected)

# Utility functions
def setUp(self):
Expand Down

0 comments on commit 6071a7c

Please sign in to comment.