Skip to content

Commit 72645bf

Browse files
committed
refactoring
1 parent 03f7860 commit 72645bf

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

utils/oracle/mock_selection_builder.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,26 @@
22
import sys
33
import os
44
import re
5-
from typing import Optional
65

76
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
87
from classes.selection_builder_exception import SelectionBuilderException
98
from classes.subject_selection_criteria_key import SubjectSelectionCriteriaKey
109

10+
# ------------------------------------------------------------------------
11+
# 🧰 Stubbed Data Classes (for symbolic mapping or subject context)
12+
# ------------------------------------------------------------------------
13+
1114

12-
# Add helper class stubs below
1315
class Subject:
1416
def __init__(self, lynch_due_date_change_reason_id):
1517
self.lynch_due_date_change_reason_id = lynch_due_date_change_reason_id
1618

1719

20+
# ------------------------------------------------------------------------
21+
# 🧪 Enum-Like Mocks (for symbolic value resolution)
22+
# ------------------------------------------------------------------------
23+
24+
1825
class NotifyEventStatus:
1926
_label_to_id = {
2027
"S1": 9901,
@@ -45,6 +52,11 @@ def from_description(cls, description: str) -> str:
4552
return key
4653

4754

55+
# ------------------------------------------------------------------------
56+
# 🧠 Utility Functions (reused parsing helpers)
57+
# ------------------------------------------------------------------------
58+
59+
4860
def parse_notify_criteria(criteria: str) -> dict:
4961
"""
5062
Parses criteria strings like 'S1 - new' or 'S1 (S1w) - sending' into parts.
@@ -64,6 +76,10 @@ def parse_notify_criteria(criteria: str) -> dict:
6476
"status": match.group("status").lower(),
6577
}
6678

79+
80+
# ------------------------------------------------------------------------
81+
# 🧪 Mock Query Builder Scaffolding (extend with testable methods)
82+
# ------------------------------------------------------------------------
6783
class MockSelectionBuilder:
6884
"""
6985
Lightweight test harness that mimics SubjectSelectionQueryBuilder behavior.
@@ -87,7 +103,9 @@ def __init__(self, criteria_key, criteria_value, criteria_comparator=">="):
87103
self.sql_where = []
88104
self.sql_from = []
89105

90-
# Don't delete this method; it is used to inspect the SQL fragments
106+
# ------------------------------------------------------------------------
107+
# 🖨️ SQL Inspection Utility (used to inspect the SQL fragments - do not remove)
108+
# ------------------------------------------------------------------------
91109
def dump_sql(self):
92110
parts = []
93111

@@ -101,6 +119,9 @@ def dump_sql(self):
101119

102120
return "\n".join(parts)
103121

122+
# ------------------------------------------------------------------------
123+
# 🔌 Required Internal Stubs (builder compatibility - do not remove)
124+
# ------------------------------------------------------------------------
104125
def _add_join_to_latest_episode(self) -> None:
105126
"""
106127
Mock stub for adding latest episode join. No-op for test harness.
@@ -130,6 +151,9 @@ def _dataset_source_for_criteria_key(self) -> dict:
130151
def _add_join_to_surveillance_review(self):
131152
self.sql_from.append("-- JOIN to surveillance review placeholder")
132153

133-
# === Add your testable method below ===
134-
# e.g., def _add_criteria_example_filter(self): ...
135-
# then use utils/oracle/test_subject_criteria_dev.py to run your scenarios
154+
155+
# ------------------------------------------------------------------------
156+
# 🧪 Add Your Custom _add_criteria_* Test Methods Below
157+
# ------------------------------------------------------------------------
158+
# e.g., def _add_criteria_example_filter(self): ...
159+
# then use utils/oracle/test_subject_criteria_dev.py to run your scenarios

0 commit comments

Comments
 (0)