def test_multiple_sentences(self): self.assertEqual( piglatin( "With great power comes great responsibility\n I 3anurag anurag3" ), "ithWay reatgay owerpay omescay reatgay esponsibilityray\n Iay 3nuragaay nuragaay3" ) self.assertEqual(piglatin("Alex=+, how did you do question 21?"), "lexAay=+, owhay idday ouyay oday uestionqay 21?")
def test_pig_latin_y(self): """ 'y' should be treated differently whether it starts the word or is in the middle. """ expected = "ellowyay" self.assertEqual(expected, piglatin("yellow")) expected = "ythmrhay" self.assertEqual(expected, piglatin("rhythm"))
def test_pig_latin_begin_vowel(self): """Words that begin with vowels should be suffixed with 'way' """ expected = "eggway" self.assertEqual(expected, piglatin("egg")) expected = "inboxway" self.assertEqual(expected, piglatin("inbox")) expected = "eightway" self.assertEqual(expected, piglatin("eight"))
def test_pig_latin_begin_consonant(self): """ Words that begin with consonants should have them moved to the end and suffixed with 'ay' """ expected = "appyhay" self.assertEqual(expected, piglatin("happy")) expected = "uckday" self.assertEqual(expected, piglatin("duck")) expected = "oveglay" self.assertEqual(expected, piglatin("glove"))
def write_latin(data): write(piglatin(data))
def __next__(self): if self.transform_ok: return piglatin(self._next()) else: return self._next()
def test_no_alphabets(self): self.assertEqual(piglatin("@123$,"), "@123$,")
def test_empty_string(self): self.assertEqual(piglatin(""), "")
def test_middle_numbers(self): self.assertEqual(piglatin("I2 am2 gr00t"), "Iay2 maay2 r00tgay")
def write_latin(data): write(piglatin(data)) # call must be byte-safe on Py3
def __next__(self): if self.transform_ok: return piglatin(self._next()) # call must be byte-safe on Py3 else: return self._next()
def write_latin(data): write(piglatin(data)) # call must be byte-safe on Py3
def __next__(self): if self.transform_ok: return piglatin(self._next()) # call must be byte-safe on Py3 else: return self._next()