| |
| """Test BaZi format generation""" |
|
|
| import sys |
| import os |
| sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
|
|
| from datetime import datetime |
| from bazi_calculator import BaziCalculator, compute_birth_pillars |
| from bazi_favorable_elements import calculate_favorable_elements |
| from api_v3 import generate_future_bazi_data |
|
|
| |
| person = { |
| 'name': 'TestUser', |
| 'gender': 'Male', |
| 'year': 1990, |
| 'month': 5, |
| 'day': 15, |
| 'hour': 10, |
| 'minute': 30, |
| 'is_twin': False |
| } |
|
|
| |
| birth_date = datetime( |
| person['year'], person['month'], person['day'], |
| person['hour'], person['minute'] |
| ) |
|
|
| print(f"Birth date: {birth_date}") |
|
|
| |
| birth_pillars = compute_birth_pillars(birth_date) |
| print(f"Birth pillars: {birth_pillars}") |
|
|
| |
| fav_elements = calculate_favorable_elements(birth_pillars) |
| print(f"Favorable elements: {fav_elements}") |
|
|
| |
| calculator = BaziCalculator( |
| birth_datetime=birth_date, |
| gender=person['gender'], |
| birth_pillars=birth_pillars |
| ) |
|
|
| print("Generating future data...") |
| future_data = generate_future_bazi_data(calculator, years_ahead=100) |
|
|
| print(f"Generated {len(future_data['luck_pillars'])} luck pillars") |
| print(f"Generated {len(future_data['annual_pillars'])} annual pillars") |
| print(f"Generated {len(future_data['monthly_pillars'])} monthly pillars") |
| print(f"Generated {len(future_data['daily_pillars'])} daily pillars") |
|
|
| |
| from dataset.dataset_generator import format_bazi_production_style |
|
|
| bazi_data = { |
| 'birth_pillars': birth_pillars, |
| 'favorable_elements': fav_elements, |
| 'future_data': future_data, |
| 'birth_date': birth_date, |
| 'calculator': calculator |
| } |
|
|
| formatted = format_bazi_production_style(person, bazi_data) |
| print("\n\nFormatted output:") |
| print("=" * 50) |
| print(formatted) |