コード例 #1
0
def test_single_player_wr():
    remove_bj_files()

    o, p, r = create_stuff()

    fop.save_player(o)

    players = fop.read_players()

    s = players[0]

    assert_equal(o.balance, s.balance)
    assert_equal(o.name, s.name)
    assert_equal(o.hand_list, [])
    assert_equal(o.current_hand, 0)

    remove_bj_files()
コード例 #2
0
def test_many_player_wr():
    remove_bj_files()

    o, p, r = create_stuff()
    players = [o, p]

    for plr in players:
        fop.save_player(plr)

    plrs_in_file = fop.read_players()

    assert_true(len(plrs_in_file) == 2)

    x = plrs_in_file[0]
    y = plrs_in_file[1]

    assert_true(x.name == o.name and y.name == p.name and 
                x.balance == o.balance and y.balance == p.balance)

    remove_bj_files()