def _get_species_grades(species_name, grade_type): spec_tags = [] if species_name: species = fo.getSpecies(species_name) if species: spec_tags = species.tags else: warn("get_species_grades() couldn't retrieve species '%s'\n" % species_name) return get_ai_tag_grade(spec_tags, grade_type)
def _get_species_grades(species_name, grade_type): spec_tags = [] if species_name: species = fo.getSpecies(species_name) if species: spec_tags = species.tags else: print >> sys.stderr, "get_species_grades() couldn't retrieve species '%s'\n" % species_name return get_ai_tag_grade(spec_tags, grade_type)
def _get_species_grades(species_name, grade_type): spec_tags = [] if species_name: species = fo.getSpecies(species_name) if species: spec_tags = species.tags else: sys.stderr.write("Error: get_species_grades couldn't retrieve species '%s'\n" % species_name) return get_ai_tag_grade(spec_tags, grade_type)
def test_tags_search_by_tag_type_with_underscore_returns_first_grade(): assert 'GREAT' == get_ai_tag_grade(['GREAT_WEAPONS_TEST'], 'WEAPONS_TEST')
def test_parse_weapon_tag_positive2(): assert 'GREAT' == get_ai_tag_grade(['GREAT_MULTI_WORD_TAG'], 'MULTI_WORD_TAG')
def test_tags_search_by_not_matching_tag_type_returns_empty_string(): assert "" == get_ai_tag_grade(["GOOD_HULL"], "WEAPONS")
def test_parse_weapon_tag_negative2(): assert '' == get_ai_tag_grade(['GREAT_WEAPONS'], 'WEAPON')
def test_parse_weapon_tag_positive1(): assert 'GREAT' == get_ai_tag_grade(['GREAT_WEAPONS'], 'WEAPONS')
def test_tags_search_by_tag_type_with_underscore_returns_first_grade(): assert "GREAT" == get_ai_tag_grade(["GREAT_WEAPONS_TEST"], "WEAPONS_TEST")
def test_parse_weapon_tag_negative1(): assert '' == get_ai_tag_grade(['WEAPONS'], 'WEAPONS')
def test_tags_search_by_tag_type_returns_grade(tags, tags_type): assert 'GREAT' == get_ai_tag_grade(tags, tags_type)
def test_very_bad_tag_parsing_find_correct_modifier(): assert "VERY_BAD" == get_ai_tag_grade(["VERY_BAD_WEAPONS"], "WEAPONS")
def test_tags_search_by_substring_tag_type_returns_empty_string( tags, tags_type): assert "" == get_ai_tag_grade(tags, tags_type)
def test_tags_search_by_not_matching_tag_type_returns_empty_string(): assert '' == get_ai_tag_grade(['GOOD_HULL'], 'WEAPONS')
def test_lowercase_tags_search_by_tag_type_returns_empty_string(tags, tags_type): assert '' == get_ai_tag_grade(tags, tags_type)