def cards(request, dominion_fix): ''' A fixture for creating example cards. ''' if not Card.objects(name=COPPER): #@UndefinedVariable create_card(name=COPPER, cost=0, type=TREASURE, money=1) if not Card.objects(name=ESTATE): #@UndefinedVariable create_card(name=ESTATE, cost=2, type=VICTORY, victory=1)
def full_ruleset(request, cards, ruleset): ''' A Fixture for creating rule_sets with content. ''' ruleset.starting_deck = [Card.objects(name=COPPER)[0]] * 7 #@UndefinedVariable ruleset.starting_deck += [Card.objects(name=ESTATE)[0]] * 3 #@UndefinedVariable for value in request.param: srs = create_specific_rule_set(parent=ruleset, player_number=value) return ruleset
def full_ruleset(request, cards, ruleset): ''' A Fixture for creating rule_sets with content. ''' ruleset.starting_deck = [Card.objects(name=COPPER)[0] ] * 7 #@UndefinedVariable ruleset.starting_deck += [Card.objects(name=ESTATE)[0] ] * 3 #@UndefinedVariable for value in request.param: srs = create_specific_rule_set(parent=ruleset, player_number=value) return ruleset
def turn_card_dict_to_list(dictionary): ''' Turns a dictionary of cards to numbers to a list of cards where each card's number of instances is equal to its mapped value in the dictionary. ''' cardlist = [] for cardname in dictionary: card = Card.objects(name=cardname)[0] #@UndefinedVariable cardlist.extend([card] * dictionary[cardname]) return cardlist