Skip to content

Commit fe9c400

Browse files
Changing the test as the incorrect one was migrated
1 parent 81e8edb commit fe9c400

File tree

4 files changed

+393
-54
lines changed

4 files changed

+393
-54
lines changed

pages/base_page.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,15 @@ def handle_dialog(dialog: Dialog, accept: bool = False):
276276
except AssertionError as e:
277277
self._dialog_assertion_error = e
278278
if accept:
279-
dialog.accept()
279+
try:
280+
dialog.accept()
281+
except Exception:
282+
logging.warning("Dialog already accepted or handled")
280283
else:
281-
dialog.dismiss() # Dismiss dialog
284+
try:
285+
dialog.dismiss() # Dismiss dialog
286+
except Exception:
287+
logging.warning("Dialog already dismissed or handled")
282288

283289
self.page.once("dialog", lambda dialog: handle_dialog(dialog, accept))
284290

pages/datasets/investigation_dataset_page.py

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,11 @@ def assert_all_drug_information(
847847
drug_numbers = [
848848
int(match.group(1))
849849
for key in drug_information
850-
if (match := re.match(r"drug_(?:dose|type)(\d+)", key))
850+
if (
851+
match := re.match(
852+
r"(?:drug|other_drug|antibiotic_drug)_(?:dose|type)(\d+)", key
853+
)
854+
)
851855
]
852856

853857
if not drug_numbers:
@@ -857,8 +861,16 @@ def assert_all_drug_information(
857861
max_drug_number = max(drug_numbers)
858862

859863
for drug_index in range(1, max_drug_number + 1):
860-
drug_type = drug_information.get(f"drug_type{drug_index}")
861-
drug_dose = drug_information.get(f"drug_dose{drug_index}")
864+
drug_type = (
865+
drug_information.get(f"drug_type{drug_index}")
866+
or drug_information.get(f"other_drug_type{drug_index}")
867+
or drug_information.get(f"antibiotic_drug_type{drug_index}")
868+
)
869+
drug_dose = (
870+
drug_information.get(f"drug_dose{drug_index}")
871+
or drug_information.get(f"other_drug_dose{drug_index}")
872+
or drug_information.get(f"antibiotic_drug_dose{drug_index}")
873+
)
862874

863875
if drug_type is not None:
864876
self.assert_drug_type_text(drug_type_label, drug_index, drug_type)
@@ -891,8 +903,25 @@ def assert_all_drug_information(
891903
| DrugTypeOptions.FLEET_PHOSPHO_SODA
892904
):
893905
expected_unit = "Mls Solution"
894-
case DrugTypeOptions.OTHER:
906+
case (
907+
DrugTypeOptions.OTHER
908+
| AntibioticsAdministeredDrugTypeOptions.OTHER_ANTIBIOTIC
909+
):
895910
expected_unit = ""
911+
case (
912+
AntibioticsAdministeredDrugTypeOptions.AMOXYCILLIN
913+
| AntibioticsAdministeredDrugTypeOptions.CEFOTAXIME
914+
| AntibioticsAdministeredDrugTypeOptions.VANCOMYCIN
915+
):
916+
expected_unit = "g"
917+
case (
918+
AntibioticsAdministeredDrugTypeOptions.CIPROFLAXACIN
919+
| AntibioticsAdministeredDrugTypeOptions.CO_AMOXICLAV
920+
| AntibioticsAdministeredDrugTypeOptions.GENTAMICIN
921+
| AntibioticsAdministeredDrugTypeOptions.METRONIDAZOLE
922+
| AntibioticsAdministeredDrugTypeOptions.TEICOPLANIN
923+
):
924+
expected_unit = "mg"
896925
case _:
897926
expected_unit = None
898927

@@ -1276,3 +1305,17 @@ class PolypReasonLeftInSituOptions(StrEnum):
12761305
REQUIRES_SURGICAL_RESECTION = "200558"
12771306
CANNOT_FIND_POLYP_ON_WITHDRAWAL = "200559"
12781307
CLINICAL_DECISION_NOT_TO_EXCISE = "203082"
1308+
1309+
1310+
class AntibioticsAdministeredDrugTypeOptions(StrEnum):
1311+
"""Enum for antobiotics administered drug type options"""
1312+
1313+
AMOXYCILLIN = "17941~g"
1314+
CEFOTAXIME = "17950~g"
1315+
CIPROFLAXACIN = "17945~mg"
1316+
CO_AMOXICLAV = "17951~mg"
1317+
GENTAMICIN = "17942~mg"
1318+
METRONIDAZOLE = "17949~mg"
1319+
TEICOPLANIN = "17944~mg"
1320+
VANCOMYCIN = "17943~g"
1321+
OTHER_ANTIBIOTIC = "305493"

0 commit comments

Comments
 (0)