Пример #1
0
    def test010_test_output(self):
        '''count_letters: testing output of function is an integer

        Your count_letters function is not returning an integer

        '''
        self.assertEqual(type(lab5.count_letters('asdf', 'a')), int)
Пример #2
0
    def test010_test_output(self):
        '''count_letters: testing output of function is an integer

        Your count_letters function is not returning an integer

        '''
        self.assertEqual(type(lab5.count_letters('asdf','a')), int)
Пример #3
0
    def test015_test_output(self):
        '''count_letters: testing output of function is correct

        Your count_letters function should return 5 for these
        arguments: 'aaaaa','a'

        '''
        self.assertEqual(lab5.count_letters('aaaaa', 'a'), 5)
Пример #4
0
    def test015_test_output(self):
        '''count_letters: testing output of function is correct

        Your count_letters function should return 5 for these
        arguments: 'aaaaa','a'

        '''
        self.assertEqual(lab5.count_letters('aaaaa','a'), 5)
Пример #5
0
    def test020_test_output(self):
        '''count_letters: testing output of function is correct

        Your count_letters function is not returning the correct output

        '''
        for a0, a1 in [('aaaa', 'a'), ('aaaa', 'b'), ('abcdabcd', 'd'),
                       ('asdf', '')]:
            self.assertEqual(lab5.count_letters(a0, a1),
                             sum(1 for c in a0 if c == a1))
Пример #6
0
    def test020_test_output(self):
        '''count_letters: testing output of function is correct

        Your count_letters function is not returning the correct output

        '''
        for a0,a1 in [('aaaa','a'), ('aaaa','b'), ('abcdabcd','d'),
                      ('asdf','')]:
            self.assertEqual(
                lab5.count_letters(a0,a1),sum(1 for c in a0 if c==a1)
            )