File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 6
6
7
7
8
8
class ChoicesEnumType (BaseType ):
9
- def __init__ (self , type_ ):
9
+ def __init__ (self , type_ , ** kwargs ):
10
10
if not issubclass (type_ , ChoicesEnum ):
11
11
raise ValidationError (self .Messages .INVALID_TYPE )
12
- super (ChoicesEnumType , self ).__init__ (type_ )
12
+ super (ChoicesEnumType , self ).__init__ (type_ , kwargs )
13
13
self .type = type_
14
14
15
15
def to_native (self , value , context = None ):
Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ def test_choices_enum_type(http_statuses):
12
12
assert state .to_primitive (200 ) == http_statuses .OK .value
13
13
14
14
15
+ def test_choices_enum_type_with_extra_params (http_statuses ):
16
+ state = ChoicesEnumType (http_statuses , required = True )
17
+ assert state .to_native (200 ) is http_statuses .OK
18
+
19
+
15
20
def test_choices_enum_type_should_throw_exception ():
16
21
with pytest .raises (ValidationError ) as e :
17
22
ChoicesEnumType (object )
You can’t perform that action at this time.
0 commit comments