コード例 #1
0
def test_chance_scores_sum_of_all_dice():
    Game = Yahtzee(1, 2, 3, 4, 5)  # Al formar el metodo parte
    # de la clase es necesario instanciarlo
    # para probarlo
    expected = 15
    actual = Game.chance(2, 3, 4, 5, 1)
    assert expected == actual
コード例 #2
0
def test_yahtzee_scores_50():
    Game = Yahtzee(1, 2, 3, 4, 5)  # Al formar el metodo parte
    # de la clase es necesario instanciarlo
    # para probarlo
    assert 50 == Game.yathzee_scores_50([4, 4, 4, 4, 4])
    assert 50 == Game.yathzee_scores_50([6, 6, 6, 6, 6])
    assert 0 == Game.yathzee_scores_50([6, 6, 6, 6, 3])
コード例 #3
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_tirar_dados(): # deberia funcionar
        """
        comprueba que la suma de los dados es correcta
        author: Antonio Jose Lojo
        """
        expected = 15
        actual = Yahtzee.tirar_dados(2,3,4,5,1)
        assert expected == actual
        assert 16 == Yahtzee.tirar_dados(3,3,4,5,1)
コード例 #4
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_par_mas_alto():
        """
        Comprueba que la funcion par mas alto funciona
        """
        # lista6 = [3,4,3,5,6]
        # lista10 = [5,3,3,3,5]
        # lista12 = [5,3,6,6,5]
        assert 6 == Yahtzee.par_mas_alto(3,4,3,5,6)
コード例 #5
0
def test_four_of_a_kind_three_of_a_kind():
    # Tres de un tipo
    Game = Yahtzee(1, 2, 3, 4, 5)
    assert 9 == Game.four_of_a_kind_three_of_a_kind([3, 3, 3, 4, 5], "three")
    assert 15 == Game.four_of_a_kind_three_of_a_kind([5, 3, 5, 4, 5], "three")
    assert 9 == Game.four_of_a_kind_three_of_a_kind([3, 3, 3, 3, 5], "three")
    # Cuatro de un tipo
    assert 12 == Game.four_of_a_kind_three_of_a_kind([3, 3, 3, 3, 5], "four")
    assert 20 == Game.four_of_a_kind_three_of_a_kind([5, 5, 5, 4, 5], "four")
    assert 12 == Game.four_of_a_kind_three_of_a_kind([3, 3, 3, 3, 3], "four")
    assert 0 == Game.four_of_a_kind_three_of_a_kind([3, 3, 3, 2, 1], "four")
コード例 #6
0
def test_1s_2s_3s():
    Game = Yahtzee(1, 2, 3, 4, 5)  # Al formar el metodo parte
    # de la clase es necesario instanciarlo
    # para probarlo

    # asserts for ones
    assert Game.ones_twos_threes([1, 2, 3, 4, 5], "ones") == 1
    assert 2 == Game.ones_twos_threes([1, 2, 1, 4, 5], "ones")
    assert 0 == Game.ones_twos_threes([6, 2, 2, 4, 5], "ones")
    assert 4 == Game.ones_twos_threes([1, 2, 1, 1, 1], "ones")
    # asserts for twos
    assert 4 == Game.ones_twos_threes([1, 2, 3, 2, 6], "twos")
    assert 10 == Game.ones_twos_threes([2, 2, 2, 2, 2], "twos")
    # asserts for threes
    assert 6 == Game.ones_twos_threes([1, 2, 3, 2, 3], "threes")
    assert 12 == Game.ones_twos_threes([2, 3, 3, 3, 3], "threes")
コード例 #7
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_tres_o_cuatro_iguales():
        assert 9 == Yahtzee.tres_o_cuatro_iguales([3,3,3,4,5])
        assert 15 == Yahtzee.tres_o_cuatro_iguales([5,3,5,4,5])
        assert 9 == Yahtzee.tres_o_cuatro_iguales([3,3,3,3,5])

        # break
        assert 12 == Yahtzee.tres_o_cuatro_iguales([3,3,3,3,5])
        assert 20 == Yahtzee.tres_o_cuatro_iguales([5,5,5,4,5])
        assert 12 == Yahtzee.tres_o_cuatro_iguales([3,3,3,3,3])
        assert 0  == Yahtzee.tres_o_cuatro_iguales([3,3,3,2,1])
コード例 #8
0
def test_small_large_list():
    # small
    Game = Yahtzee(1, 2, 3, 4, 5)
    assert 14 == Game.small_large_list([1, 2, 3, 4, 5])
    assert 14 == Game.small_large_list([2, 3, 4, 5, 1])
    assert 0 == Game.small_large_list([1, 2, 2, 4, 5])
    # large
    assert 20 == Game.small_large_list([6, 2, 3, 4, 5])
    assert 20 == Game.small_large_list([2, 3, 4, 5, 6])
    assert 0 == Game.small_large_list([1, 2, 2, 4, 5])
コード例 #9
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_tres_o_cuatro_iguales():
    # Pares de 3
    assert 9 == Yahtzee.tres_o_cuatro_iguales(3, 3, 3, 4, 5, 3)
    assert 15 == Yahtzee.tres_o_cuatro_iguales(5, 3, 5, 4, 5, 3)
    assert 9 == Yahtzee.tres_o_cuatro_iguales(3, 3, 3, 3, 5, 3)

    # Pares de 4
    assert 12 == Yahtzee.tres_o_cuatro_iguales(3, 3, 3, 3, 5, 4)
    assert 20 == Yahtzee.tres_o_cuatro_iguales(5, 5, 5, 4, 5, 4)
    assert 12 == Yahtzee.tres_o_cuatro_iguales(3, 3, 3, 3, 3, 4)

    # Opción no valida
    assert "valor de x debe ser o 3 o 4" == Yahtzee.tres_o_cuatro_iguales(
        3, 3, 3, 2, 1, 0)
コード例 #10
0
def test_three_of_a_kind():
        assert 9 == Yahtzee.three_of_a_kind(3, 3, 3, 4, 5)
        assert 15 == Yahtzee.three_of_a_kind(5, 3, 5, 4, 5)
        assert 0 == Yahtzee.three_of_a_kind(3, 3, 3, 3, 5)
コード例 #11
0
def test_four_of_a_knd():
        assert 12 == Yahtzee.four_of_a_kind(3, 3, 3, 3, 5)
        assert 20 == Yahtzee.four_of_a_kind(5, 5, 5, 4, 5)
        assert 0 == Yahtzee.three_of_a_kind(3, 3, 3, 3, 3)
コード例 #12
0
def test_largeStraight():
    assert 20 == Yahtzee.largeStraight(6, 2, 3, 4, 5)
    assert 20 == Yahtzee.largeStraight(2, 3, 4, 5, 6)
    assert 0 == Yahtzee.largeStraight(1, 2, 2, 4, 5)
コード例 #13
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_suma_solo_tres():
        assert 6 == Yahtzee.suma_solo_tres(1,2,3,2,3)
        assert 12 == Yahtzee.suma_solo_tres(2,3,3,3,3)
コード例 #14
0
def test_two_Pair():
    assert 16 == Yahtzee.two_pair(3, 3, 5, 4, 5)
    assert 0 == Yahtzee.two_pair(3, 3, 5, 5, 5)
コード例 #15
0
def test_four_of_a_knd():
    assert 12 == Yahtzee.four_of_a_kind(3, 3, 3, 3, 5)
    assert 20 == Yahtzee.four_of_a_kind(5, 5, 5, 4, 5)
    assert 0 == Yahtzee.three_of_a_kind(3, 3, 3, 3, 3)
コード例 #16
0
def test_fives():
    assert 10 == Yahtzee(4, 4, 4, 5, 5).fives()
    assert 15 == Yahtzee(4, 4, 5, 5, 5).fives()
    assert 20 == Yahtzee(4, 5, 5, 5, 5).fives()
コード例 #17
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_suma_solo_cincos():
        assert 10 == Yahtzee.suma_solo_cincos(4,4,4,5,5)
        assert 15 == Yahtzee.suma_solo_cincos(4,4,5,5,5)
        assert 20 == Yahtzee.suma_solo_cincos(4,5,5,5,5)
コード例 #18
0
def test_1s():
    assert Yahtzee.ones(1, 2, 3, 4, 5) == 1
    assert 2 == Yahtzee.ones(1, 2, 1, 4, 5)
    assert 0 == Yahtzee.ones(6, 2, 2, 4, 5)
    assert 4 == Yahtzee.ones(1, 2, 1, 1, 1)
コード例 #19
0
def test_threes():
    assert 6 == Yahtzee.threes(1, 2, 3, 2, 3)
    assert 12 == Yahtzee.threes(2, 3, 3, 3, 3)
コード例 #20
0
def test_fullHouse():
        assert 18 == Yahtzee.fullHouse(6, 2, 2, 2, 6)
        assert 0 == Yahtzee.fullHouse(2, 3, 4, 5, 6)
コード例 #21
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_par_de_dos():
        assert 16 == Yahtzee.par_de_dos([3,3,5,4,5])
        assert 18 == Yahtzee.par_de_dos([3,3,6,6,6])
        assert 0 == Yahtzee.par_de_dos([3,3,6,5,4])
コード例 #22
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_suma_solo_cuatros():
        assert 12 == Yahtzee.suma_solo_cuatros(4,4,4,5,5)
        assert 8 == Yahtzee.suma_solo_cuatros(4,4,5,5,5)
        assert 4 == Yahtzee.suma_solo_cuatros(4,5,5,5,5)
コード例 #23
0
def test_smallStraight():
        assert 15 == Yahtzee.smallStraight(1, 2, 3, 4, 5)
        assert 15 == Yahtzee.smallStraight(2, 3, 4, 5, 1)
        assert 0 == Yahtzee.smallStraight(1, 2, 2, 4, 5)
コード例 #24
0
def test_one_pair():
    assert 6 == Yahtzee.score_pair(3, 4, 3, 5, 6)
    assert 10 == Yahtzee.score_pair(5, 3, 3, 3, 5)
    assert 12 == Yahtzee.score_pair(5, 3, 6, 6, 5)
コード例 #25
0
def test_largeStraight():
        assert 20 == Yahtzee.largeStraight(6, 2, 3, 4, 5)
        assert 20 == Yahtzee.largeStraight(2, 3, 4, 5, 6)
        assert 0 == Yahtzee.largeStraight(1, 2, 2, 4, 5)
コード例 #26
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_suma_solo_seis():
        assert 0 == Yahtzee.suma_solo_seis(4,4,4,5,5)
        assert 6 == Yahtzee.suma_solo_seis(4,4,6,5,5)
        assert 18 == Yahtzee.suma_solo_seis(6,5,6,6,5)
コード例 #27
0
def test_yahtzee_scores_50():
    expected = 50
    actual = Yahtzee.yahtzee([4, 4, 4, 4, 4])
    assert expected == actual
    assert 50 == Yahtzee.yahtzee([6, 6, 6, 6, 6])
    assert 0 == Yahtzee.yahtzee([6, 6, 6, 6, 3])
コード例 #28
0
ファイル: test_yahtzee.py プロジェクト: JMRBDev/1DAW
def test_escalera_grande():
        assert 20 == Yahtzee.escalera_grande([6,2,3,4,5])
        assert 20 == Yahtzee.escalera_grande([2,3,4,5,6])
        assert 0 == Yahtzee.escalera_grande([1,2,2,4,5])
コード例 #29
0
def test_2s():
    assert 4 == Yahtzee.twos(1, 2, 3, 2, 6)
    assert 10 == Yahtzee.twos(2, 2, 2, 2, 2)
コード例 #30
0
def test_yahtzee_scores_50():
        expected = 50
        actual = Yahtzee.yahtzee([4, 4, 4, 4, 4])
        assert expected == actual
        assert 50 == Yahtzee.yahtzee([6, 6, 6, 6, 6])
        assert 0 == Yahtzee.yahtzee([6, 6, 6, 6, 3])
コード例 #31
0
def test_fours_test():
    assert 12 == Yahtzee(4, 4, 4, 5, 5).fours()
    assert 8 == Yahtzee(4, 4, 5, 5, 5).fours()
    assert 4 == Yahtzee(4, 5, 5, 5, 5).fours()
コード例 #32
0
def test_1s():
        assert Yahtzee.ones(1, 2, 3, 4, 5) == 1
        assert 2 == Yahtzee.ones(1, 2, 1, 4, 5)
        assert 0 == Yahtzee.ones(6, 2, 2, 4, 5)
        assert 4 == Yahtzee.ones(1, 2, 1, 1, 1)
コード例 #33
0
def test_sixes_test():
    assert 0 == Yahtzee(4, 4, 4, 5, 5).sixes()
    assert 6 == Yahtzee(4, 4, 6, 5, 5).sixes()
    assert 18 == Yahtzee(6, 5, 6, 6, 5).sixes()
コード例 #34
0
def test_2s():
        assert 4 == Yahtzee.twos(1, 2, 3, 2, 6)
        assert 10 == Yahtzee.twos(2, 2, 2, 2, 2)
コード例 #35
0
def test_chance_scores_sum_of_all_dice():
    expected = 15
    actual = Yahtzee.chance(2, 3, 4, 5, 1)
    assert expected == actual
    assert 16 == Yahtzee.chance(3, 3, 4, 5, 1)
コード例 #36
0
def test_threes():
        assert 6 == Yahtzee.threes(1, 2, 3, 2, 3)
        assert 12 == Yahtzee.threes(2, 3, 3, 3, 3)
コード例 #37
0
def test_three_of_a_kind():
    assert 9 == Yahtzee.three_of_a_kind(3, 3, 3, 4, 5)
    assert 15 == Yahtzee.three_of_a_kind(5, 3, 5, 4, 5)
    assert 0 == Yahtzee.three_of_a_kind(3, 3, 3, 3, 5)
コード例 #38
0
def test_one_pair():
        assert 6 == Yahtzee.score_pair(3, 4, 3, 5, 6)
        assert 10 == Yahtzee.score_pair(5, 3, 3, 3, 5)
        assert 12 == Yahtzee.score_pair(5, 3, 6, 6, 5)
コード例 #39
0
def test_smallStraight():
    assert 15 == Yahtzee.smallStraight(1, 2, 3, 4, 5)
    assert 15 == Yahtzee.smallStraight(2, 3, 4, 5, 1)
    assert 0 == Yahtzee.smallStraight(1, 2, 2, 4, 5)
コード例 #40
0
def test_chance_scores_sum_of_all_dice():
        expected = 15
        actual = Yahtzee.chance(2, 3, 4, 5, 1)
        assert expected == actual
        assert 16 == Yahtzee.chance(3, 3, 4, 5, 1)
コード例 #41
0
def test_fullHouse():
    assert 18 == Yahtzee.fullHouse(6, 2, 2, 2, 6)
    assert 0 == Yahtzee.fullHouse(2, 3, 4, 5, 6)
コード例 #42
0
def test_two_Pair():
        assert 16 == Yahtzee.two_pair(3, 3, 5, 4, 5)
        assert 0 == Yahtzee.two_pair(3, 3, 5, 5, 5)