Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pig-latin: update tests to version 1.1.0 #1049

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions exercises/grains/grains_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
total_after,
)

# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0


class GrainsTest(unittest.TestCase):
def test_square_1(self):
Expand Down
18 changes: 12 additions & 6 deletions exercises/pig-latin/pig_latin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from pig_latin import translate


# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0

class PigLatinTests(unittest.TestCase):
def test_word_beginning_with_a(self):
self.assertEqual(translate("apple"), "appleay")

def test_word_beginning_with_e(self):
self.assertEqual(translate("ear"), "earay")

Expand All @@ -30,9 +30,6 @@ def test_word_beginning_with_p(self):
def test_word_beginning_with_k(self):
self.assertEqual(translate("koala"), "oalakay")

def test_word_beginning_with_y(self):
self.assertEqual(translate("yellow"), "ellowyay")

def test_word_beginning_with_x(self):
self.assertEqual(translate("xenon"), "enonxay")

Expand Down Expand Up @@ -63,9 +60,18 @@ def test_word_beginning_with_yt(self):
def test_word_beginning_with_xr(self):
self.assertEqual(translate("xray"), "xrayay")

def test_y_is_treated_like_a_consonant_at_the_beginning_of_a_word(self):
self.assertEqual(translate("yellow"), "ellowyay")

def test_y_is_treated_like_a_vowel_at_the_end_of_a_consonant_cluster(self):
self.assertEqual(translate("rhythm"), "ythmrhay")

def test_y_as_second_letter_in_two_letter_word(self):
self.assertEqual(translate("my"), "ymay")

def test_a_whole_phrase(self):
self.assertEqual(translate("quick fast run"), "ickquay astfay unray")


if __name__ == '__main__':
unittest.main()
unittest.main()