Skip to content

Commit

Permalink
imports/code style
Browse files Browse the repository at this point in the history
  • Loading branch information
intgr committed Oct 5, 2023
1 parent 94348c5 commit b7906ca
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/test_plumbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from datetime import datetime
from enum import Enum

from rest_framework.fields import ChoiceField

if sys.version_info >= (3, 8):
from typing import TypedDict
else:
Expand Down Expand Up @@ -363,18 +361,18 @@ def test_unknown_basic_type(capsys):


def test_choicefield_choices_enum():
schema = build_choice_field(ChoiceField(['bluepill', 'redpill']))
schema = build_choice_field(serializers.ChoiceField(['bluepill', 'redpill']))
assert schema['enum'] == ['bluepill', 'redpill']
assert schema['type'] == 'string'

schema = build_choice_field(
ChoiceField(['bluepill', 'redpill'], allow_null=True, allow_blank=True)
)
schema = build_choice_field(serializers.ChoiceField(
['bluepill', 'redpill'], allow_null=True, allow_blank=True
))
assert schema['enum'] == ['bluepill', 'redpill', '', None]
assert schema['type'] == 'string'

schema = build_choice_field(
ChoiceField(['bluepill', 'redpill', '', None], allow_null=True, allow_blank=True)
)
schema = build_choice_field(serializers.ChoiceField(
choices=['bluepill', 'redpill', '', None], allow_null=True, allow_blank=True
))
assert schema['enum'] == ['bluepill', 'redpill', '', None]
assert 'type' not in schema

0 comments on commit b7906ca

Please sign in to comment.