def test_experiment_generates_auctions():
    experiment = Experiment()
    assert experiment.auctions is not None
    assert len(experiment.auctions) > 0
    for aid, auction in experiment.auctions.items():
        assert type(auction) is Auction
        assert type(aid) is int
Пример #2
0
def test_auction_signal_within_range():
    experiment = Experiment()
    auction_signal_pair = experiment.phase_three.auction_signal_pairs
    for pair in auction_signal_pair:
        auction = pair['auction']
        signal = pair['signal']
        assert auction.range_low() <= signal <= auction.range_high(), "auction {}".format(auction.aid)
def play_phase_four(browser):
    print('--Stage 4--')
    for round_number in range(1, Experiment.phase_four_rounds() + 1):
        if round_number == 1:
            play_pass_code(browser)
            # play_instructions(browser, 'four')
            play_roll_die(browser)
        play_phase_four_screen(browser, round_number)
Пример #4
0
def test_type_four_five_auctions_have_float_signals():
    experiment = Experiment()
    for auction in experiment.phase_two.auctions:
        if auction.atype == 4 or auction.atype == 5:
            for signal in auction.signals:
                assert isinstance(signal, float)
        else:
            for signal in auction.signals:
                assert isinstance(signal, int)
Пример #5
0
class Constants(BaseConstants):
    # oTree Constants
    # --------------------------------------------
    name_in_url = 'phase_three'
    players_per_group = None
    num_rounds = Experiment.phase_three_rounds()
    # Experiment Constants
    # --------------------------------------------
    INSTRUCTIONS_ROUND = 1
Пример #6
0
class Constants(BaseConstants):
    # oTree Constants
    # --------------------------------------------
    name_in_url = 'wc'
    players_per_group = None
    num_rounds = Experiment.phase_one_rounds()
    # --------------------------------------------
    # Experiment Constants
    # --------------------------------------------
    INSTRUCTIONS_ROUND = 1
    INDIFFERENT = 0
def test_right_auction_values():
    experiment = Experiment()
    for auction in experiment.phase_one.right_auctions:
        is_correct_auction_format(auction)
def test_right_auctions_have_valid_type_ids():
    experiment = Experiment()
    for auction in experiment.phase_one.right_auctions:
        assert auction.atype in [1, 2, 3, 4, 5]
Пример #9
0
def test_auction_collection_pair_not_empty():
    experiment = Experiment()
    assert experiment.phase_three.auction_signal_pairs
def test_rounds_equal_num_auction_pairs():
    experiment = Experiment()
    assert experiment.phase_one_rounds() == len(experiment.phase_one.left_auctions)
    assert experiment.phase_one_rounds() == len(experiment.phase_one.right_auctions)
def test_right_auction_types():
    experiment = Experiment()
    for right_auction in experiment.phase_one.right_auctions:
        assert type(right_auction) is Auction
def play_phase_three(browser):
    print('--Stage 3--')
    play_instructions(browser, 'three')
    for round_number in range(Experiment.phase_three_rounds()):
        play_phase_three_screen(browser, round_number)
def play_phase_two(browser):
    print('--Stage 2--')
    play_instructions(browser, 'two')
    for round_number in range(Experiment.phase_two_rounds()):
        play_phase_two_screen(browser, round_number)
Пример #14
0
def test_rounds_equals_signals_times_auctions():
    experiment = Experiment()
    rounds = experiment.phase_three_rounds()
    assert rounds == len(experiment.phase_three.auction_signal_pairs)
Пример #15
0
def test_auction_not_empty():
    experiment = Experiment()
    assert experiment.phase_two.auctions
Пример #16
0
def test_auction_min_is_less_than_max():
    experiment = Experiment()
    for auction in experiment.phase_two.auctions:
        assert auction.min_value <= auction.max_value
def test_right_auctions_not_empty():
    experiment = Experiment()
    assert experiment.phase_one.right_auctions
Пример #18
0
 def creating_session(self):
     if self.round_number == 1:
         for player in self.get_players():
             Participant.set_experiment(player, Experiment())
def test_left_auction_types():
    experiment = Experiment()
    for left_auction in experiment.phase_one.left_auctions:
        assert type(left_auction) is Auction