• test and check give two different results

Question related to mission Xs and Os Referee


for test five ([".O.","XXX",".O."]) it claims I return a 'D' but when I enter the same value as a test, I receive the correct result. am I missing something or is there a bug?

From: http://www.checkio.org/mission/x-o-referee/solve/


Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36

My Code:

def checkio(game_result):
    for y in game_result:
        if y is 'XXX':
            return 'X'
        if y in 'OOO':
            return 'O'

    for y in range(3):
        if game_result[0][y] is game_result[1][y] is game_result[2][y]:
            return game_result[0][y]

    if game_result[0][0] is game_result[1][1] is game_result[2][2]:
        return game_result[0][0]

    if game_result[0][2] is game_result[1][1] is game_result[2][0]:
        return game_result[0][2]

    return 'D'

if __name__ == '__main__':
    #These "asserts" using only for self-checking and not necessary for auto-testing
    assert checkio([
        "XOO"]) == "X", "Xs wins"
    assert checkio([
        "XOX"]) == "O", "Os wins"
    assert checkio([
        "OXX"]) == "D", "Draw"
    assert checkio([
        "XOO"]) == "X", "Xs wins again"