Skip to content

Commit

Permalink
[refs #263] Add test for tuples in TextChoice
Browse files Browse the repository at this point in the history
Why:

- Test that the fields label and value are not marked as missing

This change addresses the need by:

- Adding a test to ensure that pylint does not mark these as errors
  • Loading branch information
moritz89 committed Dec 6, 2020
1 parent ce6c3e9 commit 26f7064
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pylint_django/tests/input/func_noerror_model_enum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Test that django TextChoices does not raise a warning due to .label and .value methods
"""
# pylint: disable=missing-docstring,too-few-public-methods

from django.db import models


class SomeTextChoices(models.TextChoices):
CHOICE_A = ("choice_a", "Choice A")
CHOICE_B = ("choice_b", "Choice B")
CHOICE_C = ("choice_c", "Choice C")


class SomeClass():
choice_values = [
SomeTextChoices.CHOICE_A.value,
SomeTextChoices.CHOICE_B.value,
]
choice_labels = [
SomeTextChoices.CHOICE_B.label,
SomeTextChoices.CHOICE_C.label,
]

0 comments on commit 26f7064

Please sign in to comment.