-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_kitchen_bath.py
More file actions
217 lines (178 loc) · 6.7 KB
/
test_kitchen_bath.py
File metadata and controls
217 lines (178 loc) · 6.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#!/usr/bin/env python3
"""Test script to verify kitchen and bathroom material calculations."""
import sys
sys.path.insert(0, '/home/ubuntu/blueprint-intelligence-engine/src')
from calculator.material_calculator import MaterialCalculator, RoomTypeDetector, RoomType
from calculator.cost_estimator import CostEstimator, QualityTier, Region, compare_quality_tiers
def test_room_detection():
"""Test room type detection."""
print("\n" + "="*60)
print("ROOM TYPE DETECTION TEST")
print("="*60)
test_rooms = [
"Kitchen",
"Master Bathroom",
"Half Bath",
"Powder Room",
"Living Room",
"Master Bedroom",
"Dining Room",
"Office",
"Garage",
]
for room in test_rooms:
room_type = RoomTypeDetector.detect(room)
print(f" '{room}' -> {room_type.value}")
def test_kitchen_calculation():
"""Test kitchen material calculation."""
print("\n" + "="*60)
print("KITCHEN CALCULATION TEST")
print("="*60)
calculator = MaterialCalculator()
# Simulate a 12x14 kitchen (168 sq ft)
kitchen_data = {
'name': 'Kitchen',
'width': None,
'length': None,
'area': '168 sq ft',
'unit': 'imperial'
}
materials = calculator.calculate_from_room(kitchen_data)
print(f"\nKitchen (168 sq ft) Materials:")
print("-" * 40)
# Group by category
categories = {}
for key, qty in materials.items():
cat = qty.category
if cat not in categories:
categories[cat] = []
categories[cat].append((key, qty))
for cat, items in sorted(categories.items()):
print(f"\n{cat.upper()}:")
for key, qty in items:
print(f" {qty.material_type}: {qty.units_needed} {qty.unit} ({qty.notes})")
return materials
def test_bathroom_calculation():
"""Test bathroom material calculation."""
print("\n" + "="*60)
print("BATHROOM CALCULATION TEST")
print("="*60)
calculator = MaterialCalculator()
# Test full bathroom (80 sq ft)
full_bath_data = {
'name': 'Master Bathroom',
'width': None,
'length': None,
'area': '80 sq ft',
'unit': 'imperial'
}
# Test half bathroom (35 sq ft)
half_bath_data = {
'name': 'Powder Room',
'width': None,
'length': None,
'area': '35 sq ft',
'unit': 'imperial'
}
print(f"\nFull Bathroom (80 sq ft) Materials:")
print("-" * 40)
full_bath_materials = calculator.calculate_from_room(full_bath_data)
categories = {}
for key, qty in full_bath_materials.items():
cat = qty.category
if cat not in categories:
categories[cat] = []
categories[cat].append((key, qty))
for cat, items in sorted(categories.items()):
print(f"\n{cat.upper()}:")
for key, qty in items:
print(f" {qty.material_type}: {qty.units_needed} {qty.unit}")
print(f"\n\nHalf Bathroom (35 sq ft) Materials:")
print("-" * 40)
half_bath_materials = calculator.calculate_from_room(half_bath_data)
categories = {}
for key, qty in half_bath_materials.items():
cat = qty.category
if cat not in categories:
categories[cat] = []
categories[cat].append((key, qty))
for cat, items in sorted(categories.items()):
print(f"\n{cat.upper()}:")
for key, qty in items:
print(f" {qty.material_type}: {qty.units_needed} {qty.unit}")
return full_bath_materials, half_bath_materials
def test_full_house_estimate():
"""Test a full house with kitchen and bathrooms."""
print("\n" + "="*60)
print("FULL HOUSE ESTIMATE TEST")
print("="*60)
calculator = MaterialCalculator()
# Simulate a typical house
blueprint = {
'rooms': [
{'name': 'Kitchen', 'area': '200 sq ft', 'unit': 'imperial'},
{'name': 'Master Bathroom', 'area': '100 sq ft', 'unit': 'imperial'},
{'name': 'Bathroom 2', 'area': '60 sq ft', 'unit': 'imperial'},
{'name': 'Half Bath', 'area': '30 sq ft', 'unit': 'imperial'},
{'name': 'Living Room', 'area': '350 sq ft', 'unit': 'imperial'},
{'name': 'Dining Room', 'area': '180 sq ft', 'unit': 'imperial'},
{'name': 'Master Bedroom', 'area': '250 sq ft', 'unit': 'imperial'},
{'name': 'Bedroom 2', 'area': '150 sq ft', 'unit': 'imperial'},
{'name': 'Bedroom 3', 'area': '130 sq ft', 'unit': 'imperial'},
]
}
# Calculate materials
room_materials = calculator.calculate_from_blueprint(blueprint)
totals = calculator.get_totals(room_materials)
print(f"\nTotal Square Footage: 1,450 sq ft")
print(f"Rooms: {len(blueprint['rooms'])}")
print(f" - 1 Kitchen")
print(f" - 3 Bathrooms (1 master, 1 full, 1 half)")
print(f" - 3 Bedrooms")
print(f" - Living Room + Dining Room")
# Cost estimate
estimator = CostEstimator(
quality_tier=QualityTier.STANDARD,
region=Region.US_NATIONAL,
include_labor=True,
contingency_percent=0.10
)
estimate = estimator.estimate_project("Test House", totals)
print(f"\n" + "-"*40)
print("COST ESTIMATE (Standard Quality)")
print("-"*40)
# Group estimates by category
categories = {}
for est in estimate.estimates:
cat = est.category
if cat not in categories:
categories[cat] = []
categories[cat].append(est)
for cat in ['flooring', 'paint', 'drywall', 'trim', 'kitchen', 'bathroom']:
if cat not in categories:
continue
items = categories[cat]
cat_total = sum(e.total_cost for e in items)
print(f"\n{cat.upper()}: ${cat_total:,.2f}")
for est in items:
print(f" {est.display_name}: ${est.total_cost:,.2f} ({est.units_needed} {est.unit})")
print(f"\n" + "="*40)
print(f"Materials Subtotal: ${estimate.subtotal_materials:,.2f}")
print(f"Labor Subtotal: ${estimate.subtotal_labor:,.2f}")
print(f"Contingency (10%): ${estimate.contingency_amount:,.2f}")
print(f"GRAND TOTAL: ${estimate.total_estimate:,.2f}")
print("="*40)
# Quality tier comparison
print("\nQUALITY TIER COMPARISON:")
tier_comparison = compare_quality_tiers(totals)
for tier, total in tier_comparison.items():
print(f" {tier.capitalize()}: ${total:,.2f}")
return estimate
if __name__ == "__main__":
test_room_detection()
test_kitchen_calculation()
test_bathroom_calculation()
test_full_house_estimate()
print("\n" + "="*60)
print("ALL TESTS COMPLETED!")
print("="*60)