Skip to content

Commit

Permalink
reformat files
Browse files Browse the repository at this point in the history
  • Loading branch information
Buhle79 committed Apr 10, 2024
1 parent 8c9231c commit 2e3043d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 15 deletions.
6 changes: 3 additions & 3 deletions base/actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def submit(
domain: Dict[Text, Any],
) -> List[Dict]:
"""Define what the form has to do
after all required slots are filled"""
after all required slots are filled"""

# utter submit template
return []
Expand Down Expand Up @@ -516,7 +516,7 @@ def submit(
domain: Dict[Text, Any],
) -> List[Dict]:
"""Define what the form has to do
after all required slots are filled"""
after all required slots are filled"""

# utter submit template
return []
Expand Down Expand Up @@ -796,7 +796,7 @@ async def submit(
domain: Dict[Text, Any],
) -> List[Dict]:
"""Define what the form has to do
after all required slots are filled"""
after all required slots are filled"""
data = self.get_risk_data(tracker)
risk = utils.get_risk_level(data)
study_a_arm = None
Expand Down
33 changes: 27 additions & 6 deletions base/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ async def test_validate_location_text(self):
"""
form = HealthCheckProfileForm()

tracker = self.get_tracker_for_text_slot_with_message("location", "Cape Town",)
tracker = self.get_tracker_for_text_slot_with_message(
"location",
"Cape Town",
)

events = await form.validate(CollectingDispatcher(), tracker, {})
assert events == [
Expand All @@ -265,7 +268,10 @@ async def test_validate_location_google_places(self):
"geometry": {"location": {"lat": 1.23, "lng": 4.56}},
}

tracker = self.get_tracker_for_text_slot_with_message("location", "Cape Town",)
tracker = self.get_tracker_for_text_slot_with_message(
"location",
"Cape Town",
)

events = await form.validate(CollectingDispatcher(), tracker, {})
assert events == [
Expand All @@ -285,7 +291,10 @@ async def test_validate_location_google_places_no_results(self):
form.places_lookup = utils.AsyncMock()
form.places_lookup.return_value = None

tracker = self.get_tracker_for_text_slot_with_message("location", "Cape Town",)
tracker = self.get_tracker_for_text_slot_with_message(
"location",
"Cape Town",
)

dispatcher = CollectingDispatcher()
events = await form.validate(dispatcher, tracker, {})
Expand All @@ -308,7 +317,10 @@ async def test_validate_location_google_places_error(self):
form.places_lookup = utils.AsyncMock()
form.places_lookup.side_effect = Exception()

tracker = self.get_tracker_for_text_slot_with_message("location", "Cape Town",)
tracker = self.get_tracker_for_text_slot_with_message(
"location",
"Cape Town",
)

dispatcher = CollectingDispatcher()
events = await form.validate(dispatcher, tracker, {})
Expand Down Expand Up @@ -505,7 +517,9 @@ def test_complete_form(self):
form = HealthCheckProfileForm()
dispatcher = CollectingDispatcher()
tracker = utils.get_tracker_for_slot_from_intent(
form, "medical_condition", "no",
form,
"medical_condition",
"no",
)
result = form.submit(dispatcher, tracker, {})
assert result == []
Expand Down Expand Up @@ -857,7 +871,14 @@ async def test_validate_yes_no_maybe(self):
class TestActionSendStudyMessages:
def get_tracker_with_slot(self, slots):
return Tracker(
"default", slots, {"text": "test"}, [], False, None, {}, "action_listen",
"default",
slots,
{"text": "test"},
[],
False,
None,
{},
"action_listen",
)

@pytest.mark.asyncio
Expand Down
2 changes: 1 addition & 1 deletion hh/actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ async def submit(
domain: Dict[Text, Any],
) -> List[Dict]:
"""Define what the form has to do
after all required slots are filled"""
after all required slots are filled"""
return []


Expand Down
23 changes: 18 additions & 5 deletions hh/tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def test_validate_destination_province(self):
dispatcher = CollectingDispatcher()
response = form.validate_destination_province("1", dispatcher, tracker, {})
self.assertEqual(
response, {"destination_province": "ec"},
response,
{"destination_province": "ec"},
)

def test_validate_university(self):
Expand Down Expand Up @@ -108,7 +109,8 @@ def test_validate_university_confirm(self):
dispatcher = CollectingDispatcher()
response = form.validate_university_confirm("1", dispatcher, tracker, {})
self.assertEqual(
response, {"university_confirm": "AFDA", "campus_list": "*1.* Cenral"},
response,
{"university_confirm": "AFDA", "campus_list": "*1.* Cenral"},
)

def test_validate_campus(self):
Expand All @@ -126,7 +128,8 @@ def test_validate_campus(self):
dispatcher = CollectingDispatcher()
response = form.validate_campus("1", dispatcher, tracker, {})
self.assertEqual(
response, {"campus": "Cenral"},
response,
{"campus": "Cenral"},
)

@patch("hh.actions.actions.CollectingDispatcher.utter_message")
Expand All @@ -145,7 +148,8 @@ def test_validate_vaccine_uptake(self, mock_utter):
dispatcher = CollectingDispatcher()
response = form.validate_vaccine_uptake("3", dispatcher, tracker, {})
self.assertEqual(
response, {"vaccine_uptake": "NOT"},
response,
{"vaccine_uptake": "NOT"},
)
mock_utter.assert_called_once_with(template="utter_not_vaccinated")

Expand Down Expand Up @@ -466,7 +470,16 @@ async def test_assign_study_b_arm(self):
}
events = await action.run(
dispatcher,
Tracker("27820001001", {}, {}, [], False, None, {}, "action_listen",),
Tracker(
"27820001001",
{},
{},
[],
False,
None,
{},
"action_listen",
),
{},
)
assert SlotSet("start_time", "2022-03-09T07:33:29.046948Z") in events

0 comments on commit 2e3043d

Please sign in to comment.