Spaces:
Running
Running
th commited on
Commit ·
94ffb73
1
Parent(s): 40d3e55
Handle absent wealth relation in complete BaZi interpretation
Browse files- ai_interpreter.py +1 -1
- test_birth_time_context.py +14 -0
ai_interpreter.py
CHANGED
|
@@ -413,7 +413,7 @@ class AIInterpreter:
|
|
| 413 |
wealth_analysis = self.genju.get('wealth_analysis', {})
|
| 414 |
detail = wealth_analysis.get('analysis_detail', {})
|
| 415 |
body = detail.get('body_wealth', {})
|
| 416 |
-
relation = body.get('relation_status'
|
| 417 |
|
| 418 |
text = "**Current wealth channel & carrying capacity**\n\n"
|
| 419 |
relation_map = {
|
|
|
|
| 413 |
wealth_analysis = self.genju.get('wealth_analysis', {})
|
| 414 |
detail = wealth_analysis.get('analysis_detail', {})
|
| 415 |
body = detail.get('body_wealth', {})
|
| 416 |
+
relation = body.get('relation_status') or ''
|
| 417 |
|
| 418 |
text = "**Current wealth channel & carrying capacity**\n\n"
|
| 419 |
relation_map = {
|
test_birth_time_context.py
CHANGED
|
@@ -185,3 +185,17 @@ def test_cross_year_timezone_does_not_shift_virtual_birth_age():
|
|
| 185 |
assert cycle["start_age"] == cycle["liunian"][0]["year"] - 2024 + 1
|
| 186 |
for year in cycle["liunian"]:
|
| 187 |
assert year["age"] == year["year"] - 2024 + 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
assert cycle["start_age"] == cycle["liunian"][0]["year"] - 2024 + 1
|
| 186 |
for year in cycle["liunian"]:
|
| 187 |
assert year["age"] == year["year"] - 2024 + 1
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
@pytest.mark.parametrize("date,clock,zone,fold", [
|
| 191 |
+
("1990-07-15", "09:30", "Australia/Melbourne", None),
|
| 192 |
+
("2024-11-03", "01:30", "America/New_York", 0),
|
| 193 |
+
("2024-11-03", "01:30", "America/New_York", 1),
|
| 194 |
+
])
|
| 195 |
+
def test_interpretation_handles_absent_wealth_relation_and_resolved_clocks(client, date, clock, zone, fold):
|
| 196 |
+
response = client.post("/ai-interpretation", json={
|
| 197 |
+
"birth_date": date, "birth_time": clock, "gender": "female", "timezone": zone,
|
| 198 |
+
"time_basis": "standard", "fold": fold, "interpretation_level": "basic", "language": "en", "num_dayun": 10,
|
| 199 |
+
})
|
| 200 |
+
assert response.status_code == 200, response.text[:500]
|
| 201 |
+
assert response.json()["data"]["life_curve_data"]["yearly_data"]
|