def test_no_equal(self): self.assertEqual(inverse_captcha([1, 2]), 0)
def test_step_half(self): self.assertEqual(inverse_captcha([1, 2, 1, 2], 2), 6) self.assertEqual(inverse_captcha([1, 2, 2, 1], 2), 0) self.assertEqual(inverse_captcha_from_string('123425', 3), 4) self.assertEqual(inverse_captcha_from_string('123123', 3), 12) self.assertEqual(inverse_captcha_from_string('12131415', 4), 4)
def test_empty(self): self.assertEqual(inverse_captcha([]), 0)
def test_wrapping(self): self.assertEqual(inverse_captcha([9, 1, 9]), 9)
def test_given(self): self.assertEqual(inverse_captcha([1, 1, 2, 2]), 3) self.assertEqual(inverse_captcha([1, 1, 1, 1]), 4) self.assertEqual(inverse_captcha([1, 2, 3, 4]), 0) self.assertEqual(inverse_captcha([9, 1, 2, 1, 2, 1, 2, 9]), 9)
def test_inverse_captcha(): assert inverse_captcha([1, 1, 2, 2]) == 3 assert inverse_captcha([1, 1, 1, 1]) == 4 assert inverse_captcha([1, 2, 3, 4]) == 0 assert inverse_captcha([9, 1, 2, 1, 2, 1, 2, 9]) == 9
def test_simple(self): self.assertEqual(inverse_captcha([1, 1, 5]), 1)
def test_results(self): self.assertEqual(inverse_captcha('1122'), 3) self.assertEqual(inverse_captcha('1111'), 4) self.assertEqual(inverse_captcha('1234'), 0) self.assertEqual(inverse_captcha('91212129'), 9)
def test_inverse_captcha_of_1111_is_4(self): self.assertEquals(4, inverse_captcha.inverse_captcha(1111))
def test_inverse_captcha_of_1122_is_3(self): self.assertEquals(3, inverse_captcha.inverse_captcha(1122))
def test_inverse_captcha_of_91212129_is_9(self): self.assertEquals(9, inverse_captcha.inverse_captcha(91212129))
def test_inverse_captcha_of_1234_is_0(self): self.assertEquals(0, inverse_captcha.inverse_captcha(1234))