コード例 #1
0
    def test_example_a3(self):
        pg = day11.PasswordGenerator()
        # req #3
        self.assertFalse(pg.has_non_overlapping_pairs('abbcegjk'))

        # fails any requirements => invalid password
        self.assertFalse(pg.valid_password('abbcegjk'))
コード例 #2
0
    def test_example_a1(self):
        pg = day11.PasswordGenerator()
        # req #1
        self.assertTrue(pg.has_increasing_straight('hijklmmn'))
        # req #2
        self.assertTrue(pg.has_invalid_chars('hijklmmn'))

        # fails any requirements => invalid password
        self.assertFalse(pg.valid_password('hijklmmn'))
コード例 #3
0
    def test_example_a2(self):
        pg = day11.PasswordGenerator()
        # req #1
        self.assertFalse(pg.has_increasing_straight('abbceffg'))
        # req #3
        self.assertTrue(pg.has_non_overlapping_pairs('abbceffg'))

        # fails any requirements => invalid password
        self.assertFalse(pg.valid_password('abbceffg'))
コード例 #4
0
 def test_example_a5(self):
     pg = day11.PasswordGenerator()
     self.assertEqual(pg.next_password('ghijklmn'), 'ghjaabcc')
コード例 #5
0
 def test_example_a4(self):
     pg = day11.PasswordGenerator()
     self.assertEqual(pg.next_password('abcdefgh'), 'abcdffaa')