def test_gets_two_items_when_they_are_equally_likely(self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM items = [ ('lightball', 50), ('other_item', 50), ] possible_items = p.get_possible_items(items) expected_items = ['lightball', 'other_item'] self.assertEqual(expected_items, possible_items)
def test_gets_revealed_item_when_item_is_revealed(self): p = Pokemon('pikachu', 100) p.item = 'lightball' items = [ ('lightball', 50), ('leftovers', 50), ] possible_items = p.get_possible_items(items) expected_items = ['lightball'] self.assertEqual(expected_items, possible_items)
def test_gets_none_when_item_is_none(self): p = Pokemon('pikachu', 100) p.item = None items = [ ('lightball', 50), ('leftovers', 50), ] possible_items = p.get_possible_items(items) expected_items = [None] self.assertEqual(expected_items, possible_items)
def test_does_not_guess_lifeorb_when_can_have_lifeorb_is_false(self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM p.can_have_life_orb = False items = [ ('lifeorb', 50), ('lightball', 50), # should be guessed because flag is set to True ] possible_items = p.get_possible_items(items) expected_items = ['lightball'] self.assertEqual(expected_items, possible_items)
def test_works_with_one_item(self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM items = [ ('lightball', 100), ] possible_items = p.get_possible_items(items) expected_items = [ 'lightball', ] self.assertEqual(expected_items, possible_items)
def test_stops_once_cumulative_percentage_exceeds_limit(self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM items = [ ('lightball', 50), ('other_item', 30), ('another_item', 20), ] possible_items = p.get_possible_items(items) expected_items = ['lightball', 'other_item'] self.assertEqual(expected_items, possible_items)
def test_guesses_assultvest_when_can_have_assultvest_flag_is_true(self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM p.can_have_assaultvest = True items = [ ('lightball', 50), ('assaultvest', 50), ] possible_items = p.get_possible_items(items) expected_items = ['lightball', 'assaultvest'] self.assertEqual(expected_items, possible_items)
def test_guesses_choice_item_when_can_have_choice_item_flag_is_true(self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM p.can_have_choice_item = True items = [ ('lightball', 50), ('choiceband', 50), # should be guessed because flag is set to True ] possible_items = p.get_possible_items(items) expected_items = ['lightball', 'choiceband'] self.assertEqual(expected_items, possible_items)
def test_ignores_item_in_pass_items(self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM items = [ ('lightball', 50), ('leftovers', 50), # leftovers is ignored because it reveals itself ] possible_items = p.get_possible_items(items) expected_items = [ 'lightball', ] self.assertEqual(expected_items, possible_items)
def test_guesses_choiceband_when_can_not_have_band_is_false(self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM p.can_not_have_band = False items = [ ('lightball', 50), ('choiceband', 50), # should NOT be ignored because flag is set to False ] possible_items = p.get_possible_items(items) expected_items = ['lightball', 'choiceband'] self.assertEqual(expected_items, possible_items)
def test_does_not_guess_assultvest_when_can_have_assultvest_flag_is_false( self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM p.can_have_assaultvest = False items = [ ('lightball', 50), ('assaultvest', 50), # should be ignored because flag is set to False ] possible_items = p.get_possible_items(items) expected_items = [ 'lightball', ] self.assertEqual(expected_items, possible_items)
def test_can_not_have_choice_specs_flag_does_not_affect_choice_band_guess( self): p = Pokemon('pikachu', 100) p.item = constants.UNKNOWN_ITEM p.can_not_have_specs = True p.can_not_have_band = False items = [ ('lightball', 50), ('choiceband', 50), # should NOT be ignored because flag is set to False # choice_specs flag doesn't matter ] possible_items = p.get_possible_items(items) expected_items = ['lightball', 'choiceband'] self.assertEqual(expected_items, possible_items)