File tree 2 files changed +11
-0
lines changed
conference-planner/planner
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ def __init__(self, conf_data: dict):
23
23
24
24
self .name = conf_data [KEYWORD .NAME ]
25
25
self .duration = conf_data [KEYWORD .DURATION ]
26
+
27
+ if self .duration < 5 :
28
+ raise ValueError ('Duration less than 5 is not supported' )
29
+
26
30
self .is_networking = conf_data [KEYWORD .IS_NETWORKING ]
27
31
28
32
def is_networking_track (self ) -> bool :
Original file line number Diff line number Diff line change @@ -10,6 +10,13 @@ def test_model_validator_missing_keys(self):
10
10
]
11
11
with pytest .raises (Exception ):
12
12
_ = ConferenceInfo (conference_json_data )
13
+
14
+ def test_model_validator_less_duration (self ):
15
+ conference_json_data = [
16
+ {"Name" : "Overdoing it in Python" , "Duration" : 4 , "isNetworking" : False }
17
+ ]
18
+ with pytest .raises (Exception ):
19
+ _ = ConferenceInfo (conference_json_data )
13
20
14
21
def test_model_validator_wrong_type (self ):
15
22
conference_json_data = [
You can’t perform that action at this time.
0 commit comments