Skip to content

IndexError in serializers causing test failures #1313

@joereg4

Description

@joereg4

Problem

Two tests are failing due to IndexError: list index out of range in the serializers:

  1. test_location_area_api - Failing in LocationAreaDetailSerializer.get_encounters()
  2. test_pokemon_api - Failing in PokemonDetailSerializer.get_pokemon_moves()

Error Details

Test 1: test_location_area_api

File "/code/pokemon_v2/serializers.py", line 1221, in get_encounters
    version_detail["version"] = version_data[ver["version"] - 1]
IndexError: list index out of range

Test 2: test_pokemon_api

File "/code/pokemon_v2/serializers.py", line 4745, in get_pokemon_moves
    version_detail["version_group"] = version_data[move["version_group"] - 1]
IndexError: list index out of range

Expected Behavior

  • test_location_area_api should pass
  • test_pokemon_api should pass
  • All 51 tests should pass

Current Behavior

  • 2 tests failing with IndexError
  • Test suite shows "FAILED (errors=2)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions