          assert items[9].value == 'boolean'
  
  
  class TestChoiceFieldWithType(FieldValues):
      """
      Valid and invalid values for a `Choice` field that uses an integer type,
      instead of a char type.
 
</s> remove         # Map the string representation of choices to the underlying value.
        # Allows us to deal with eg. integer choices while supporting either
        # integer or string input, but still get the correct datatype out.
        self.choice_strings_to_values = {
            six.text_type(key): key for key in self.choices.keys()
        }

 </s> add  </s> remove         self.grouped_choices = to_choices_dict(choices)
        self.choices = flatten_choices_dict(self.grouped_choices)
 </s> add         self.choices = choices
    def test_edit_choices(self):
        field = serializers.ChoiceField(
            allow_null=True,
            choices=[
                1, 2,
            ]
        )
        field.choices = [1]
        assert field.run_validation(1) is 1
        with pytest.raises(serializers.ValidationError) as exc_info:
            field.run_validation(2)
        assert exc_info.value.detail == ['"2" is not a valid choice.']

          assert items[9].value == 'boolean'
  
    def test_edit_choices(self):
        field = serializers.ChoiceField(
            allow_null=True,
            choices=[
                1, 2,
            ]
        )
        field.choices = [1]
        assert field.run_validation(1) is 1
        with pytest.raises(serializers.ValidationError) as exc_info:
            field.run_validation(2)
        assert exc_info.value.detail == ['"2" is not a valid choice.']

  
  class TestChoiceFieldWithType(FieldValues):
      """
      Valid and invalid values for a `Choice` field that uses an integer type,
      instead of a char type.
keep add keep keep keep keep keep
 Allow `ChoiceField.choices` to be set dynamically (#5426)

## Description

The `choices` field for the `ChoiceField` class should be able to be edited after `ChoiceField.__init__` is called.

```
field = ChoiceField(choices=[1,2])
field.choices = [1]  # Should no longer allow `2` as a choice
```

Currently, you must update `choices`, `grouped_choices`, and `choice_strings_to_values` to achieve this. This P/R keeps `grouped_choices` and `choice_strings_to_values` in sync whenever the `choices` are edited. 
tests/test_fields.py