예제 #1
0
def test_alphabet_position():
    x = "20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11"
    assert alphabet_position("The sunset sets at twelve o' clock.") == x

    x = "20 8 5 14 1 18 23 8 1 12 2 1 3 15 14 19 1 20 13 9 4 14 9 7 8 20"
    assert alphabet_position("The narwhal bacons at midnight.") == x

    number_test = ""
    for item in range(10):
        number_test += str(randint(1, 9))
    assert alphabet_position(number_test) == ""
    def test(self):
        self.assertEqual(
            alphabet_position("The sunset sets at twelve o' clock."),
            "20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11"
        )
        self.assertEqual(
            alphabet_position("The narwhal bacons at midnight."),
            "20 8 5 14 1 18 23 8 1 12 2 1 3 15 14 19 1 20 13 9 4 14 9 7 8 20")

        number_test = ""
        for item in range(10):
            number_test += str(randint(1, 9))
        self.assertEqual(alphabet_position(number_test), "")
예제 #3
0
 def test_1(self):
     result = alphabet_position("The sunset sets at twelve o' clock.")
     self.assertEqual(
         result,
         "20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11",
     )
예제 #4
0
 def test_rand(self):
     for i in range(100):
         x = ''.join(choice(string.ascii_letters) for _ in range(100))
         self.assertEqual(alphabet_position(x), ap(x))
예제 #5
0
 def test_nonletter(self):
     self.assertEqual(alphabet_position("-.-'"), "")
예제 #6
0
 def test(self):
     for letter in string.ascii_lowercase:
         self.assertEqual(alphabet_position(letter), ap(letter))