Skip to content

Commit 8d76c66

Browse files
committed
chore: add check for under 5 duration track
1 parent 352cb81 commit 8d76c66

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

conference-planner/planner/model.py

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def __init__(self, conf_data: dict):
2323

2424
self.name = conf_data[KEYWORD.NAME]
2525
self.duration = conf_data[KEYWORD.DURATION]
26+
27+
if self.duration < 5:
28+
raise ValueError('Duration less than 5 is not supported')
29+
2630
self.is_networking = conf_data[KEYWORD.IS_NETWORKING]
2731

2832
def is_networking_track(self) -> bool:

conference-planner/planner/tests/test_model.py

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ def test_model_validator_missing_keys(self):
1010
]
1111
with pytest.raises(Exception):
1212
_ = 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)
1320

1421
def test_model_validator_wrong_type(self):
1522
conference_json_data = [

0 commit comments

Comments
 (0)