def test_skipped_space(self): self.assertEqual(typo.StrErrer('', seed=1).skipped_space().result, '') self.assertEqual(typo.StrErrer(' ', seed=1).skipped_space().result, '') self.assertEqual( typo.StrErrer(' ', seed=1).skipped_space().result, ' ') self.assertEqual( typo.StrErrer('Hello world!', seed=1).skipped_space().result, 'Helloworld!') self.assertEqual( typo.StrErrer('Hello world! Happy new year 2021.', seed=5).skipped_space().result, 'Hello world! Happy new year2021.')
def test_similar_char(self): self.assertEqual(typo.StrErrer('', seed=1).similar_char().result, '') self.assertEqual(typo.StrErrer('Z', seed=1).similar_char().result, '2') self.assertEqual( typo.StrErrer('2021', seed=1).similar_char().result, '2D21') self.assertEqual( typo.StrErrer('Hello world! Happy new year 2021.', seed=1).similar_char().result, 'Hell0 world! Happy new year 2021.') self.assertEqual( typo.StrErrer('To be or not to be that is the question.', seed=2).similar_char().result, 'To be or not to be that is the questIon.')
def test_char_swap(self): self.assertEqual(typo.StrErrer('', seed=1).char_swap().result, '') self.assertEqual(typo.StrErrer(' ', seed=1).char_swap().result, ' ') self.assertEqual(typo.StrErrer('a', seed=1).char_swap().result, 'a') self.assertEqual(typo.StrErrer('ab', seed=1).char_swap().result, 'ba') self.assertEqual( typo.StrErrer('abc', seed=1).char_swap().result, 'bac') self.assertEqual( typo.StrErrer('2021', seed=1).char_swap().result, '0221') self.assertEqual( typo.StrErrer('Hello World! Happy new year 2021.', seed=13).char_swap().result, 'Hello World! Ahppy new year 2021.')
def test_unichar(self): self.assertEqual(typo.StrErrer('', seed=1).unichar().result, '') self.assertEqual(typo.StrErrer(' ', seed=1).unichar().result, ' ') self.assertEqual(typo.StrErrer(' ', seed=1).unichar().result, ' ') self.assertEqual(typo.StrErrer('aa', seed=1).unichar().result, 'a') self.assertEqual( typo.StrErrer('apple', seed=1).unichar().result, 'aple') self.assertEqual( typo.StrErrer('aaabbbccc', seed=5).unichar().result, 'aaabbbcc') self.assertEqual( typo.StrErrer('Hello world! Happy new year 2021.', seed=1).unichar().result, 'Helo world! Happy new year 2021.') self.assertEqual( typo.StrErrer('Hello world! Happy new year 2021.', seed=5).unichar().result, 'Hello world! Hapy new year 2021.')
def test_nearby_char(self): self.assertEqual(typo.StrErrer('', seed=1).nearby_char().result, '') self.assertEqual(typo.StrErrer(' ', seed=1).nearby_char().result, ' ') self.assertEqual(typo.StrErrer('w', seed=1).nearby_char().result, 'e') self.assertEqual( typo.StrErrer('$fghh', seed=1).nearby_char().result, '$fbhh') self.assertEqual( typo.StrErrer('happy', seed=2).nearby_char().result, 'nappy') self.assertEqual( typo.StrErrer('Hello World! Happy new year 2021.', seed=5).nearby_char().result, 'Hello World! Happy new ysar 2021.')
def test_missing_char(self): self.assertEqual(typo.StrErrer('', seed=1).missing_char().result, '') self.assertEqual( typo.StrErrer(' ', seed=1).missing_char().result, ' ') self.assertEqual(typo.StrErrer('a', seed=1).missing_char().result, 'a') self.assertEqual( typo.StrErrer('ab', seed=1).missing_char().result, 'b') self.assertEqual( typo.StrErrer('abcdefgh', seed=1).missing_char().result, 'abdefgh') self.assertEqual( typo.StrErrer('2021', seed=1).missing_char().result, '221') self.assertEqual( typo.StrErrer('Hello World! Happy new year 2021.', seed=2).missing_char().result, 'Hllo World! Happy new year 2021.') self.assertEqual( typo.StrErrer('Hello World! Happy new year 2021.', seed=7).missing_char().result, 'Hello World! appy new year 2021.')
def test_random_space(self): self.assertEqual(typo.StrErrer('', seed=1).random_space().result, '') self.assertEqual(typo.StrErrer(' ', seed=1).random_space().result, ' ') self.assertEqual( typo.StrErrer('a', seed=1).random_space().result, ' a') self.assertEqual( typo.StrErrer('ab', seed=5).random_space().result, 'a b') self.assertEqual( typo.StrErrer('abcdefgh', seed=6).random_space().result, 'a bcdefgh') self.assertEqual( typo.StrErrer('2021', seed=5).random_space().result, '20 21') self.assertEqual( typo.StrErrer('Hello world! Happy new year 2021.', seed=634).random_space().result, 'Hell o world! Happy new year 2021.')
def test_extra_char(self): self.assertEqual(typo.StrErrer('', seed=1).extra_char().result, '') self.assertEqual(typo.StrErrer(' ', seed=1).extra_char().result, ' ') self.assertEqual(typo.StrErrer('a', seed=1).extra_char().result, 'qa') self.assertEqual( typo.StrErrer('gh', seed=2).extra_char().result, 'fgh') self.assertEqual( typo.StrErrer('2021', seed=2).extra_char().result, '02021') self.assertEqual( typo.StrErrer('Hello World! Happy new year 2021.', seed=2).extra_char().result, 'Hrello World! Happy new year 2021.') self.assertEqual( typo.StrErrer('Hello World! Happy new year 2021.', seed=7).extra_char().result, 'Hello World! BHappy new year 2021.')
def test_repeated_char(self): self.assertEqual(typo.StrErrer('', seed=1).repeated_char().result, '') self.assertEqual( typo.StrErrer(' ', seed=1).repeated_char().result, ' ') self.assertEqual( typo.StrErrer('a', seed=1).repeated_char().result, 'aa') self.assertEqual( typo.StrErrer('ab', seed=2).repeated_char().result, 'aab') self.assertEqual( typo.StrErrer('abcdefgh', seed=5).repeated_char().result, 'abcdeefgh') self.assertEqual( typo.StrErrer('Hello world! Happy new year 2021.', seed=4).repeated_char().result, 'Hello worrld! Happy new year 2021.')