value edit; test fix
This commit is contained in:
@@ -56,7 +56,7 @@ class CalculatorTest(unittest.TestCase):
|
||||
self.subject = Calculator(self.values)
|
||||
|
||||
expected = [
|
||||
Subarray(subarray_number=1, origin=Coordinate(0, 0), required_seismic_anchors=435, weight=170237,
|
||||
Subarray(subarray_number=1, origin=Coordinate(0, 0), required_seismic_anchors=436, weight=170698.330000,
|
||||
start_row=0, size=863, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=130.5, column_count=98)
|
||||
]
|
||||
@@ -70,43 +70,43 @@ class CalculatorTest(unittest.TestCase):
|
||||
self.subject = Calculator(self.values)
|
||||
|
||||
expected = [
|
||||
Subarray(subarray_number=1, origin=Coordinate(0, 0), required_seismic_anchors=11, weight=23783, start_row=0,
|
||||
Subarray(subarray_number=1, origin=Coordinate(0, 0), required_seismic_anchors=11, weight=23804, start_row=0,
|
||||
size=192, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=18, column_count=20),
|
||||
Subarray(subarray_number=2, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=13113,
|
||||
Subarray(subarray_number=2, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=13271,
|
||||
start_row=192, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=4, column_count=24),
|
||||
Subarray(subarray_number=3, origin=Coordinate(0, 0), required_seismic_anchors=110, weight=40406,
|
||||
Subarray(subarray_number=3, origin=Coordinate(0, 0), required_seismic_anchors=110, weight=40328,
|
||||
start_row=288, size=312, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=25, column_count=29),
|
||||
Subarray(subarray_number=4, origin=Coordinate(0, 0), required_seismic_anchors=72, weight=23404,
|
||||
Subarray(subarray_number=4, origin=Coordinate(0, 0), required_seismic_anchors=71, weight=23324,
|
||||
start_row=600, size=168, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=22, column_count=13),
|
||||
Subarray(subarray_number=5, origin=Coordinate(0, 0), required_seismic_anchors=75, weight=35365,
|
||||
Subarray(subarray_number=5, origin=Coordinate(0, 0), required_seismic_anchors=74, weight=35170,
|
||||
start_row=768, size=234, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=26, column_count=14),
|
||||
Subarray(subarray_number=6, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=10897,
|
||||
Subarray(subarray_number=6, origin=Coordinate(0, 0), required_seismic_anchors=1, weight=11461,
|
||||
start_row=1002, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=10, column_count=12),
|
||||
Subarray(subarray_number=7, origin=Coordinate(0, 0), required_seismic_anchors=29, weight=10951,
|
||||
Subarray(subarray_number=7, origin=Coordinate(0, 0), required_seismic_anchors=28, weight=10865,
|
||||
start_row=1098, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=8, column_count=16),
|
||||
Subarray(subarray_number=8, origin=Coordinate(0, 0), required_seismic_anchors=11, weight=10596,
|
||||
Subarray(subarray_number=8, origin=Coordinate(0, 0), required_seismic_anchors=12, weight=10780,
|
||||
start_row=1194, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=15, column_count=17.5),
|
||||
Subarray(subarray_number=9, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=10544,
|
||||
Subarray(subarray_number=9, origin=Coordinate(0, 0), required_seismic_anchors=0, weight= 10989,
|
||||
start_row=1290, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=8, column_count=16),
|
||||
Subarray(subarray_number=10, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=4819,
|
||||
Subarray(subarray_number=10, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=4901,
|
||||
start_row=1386, size=48, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=8, column_count=6),
|
||||
Subarray(subarray_number=11, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=10857,
|
||||
Subarray(subarray_number=11, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=10766,
|
||||
start_row=1434, size=96, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=13, column_count=13),
|
||||
Subarray(subarray_number=12, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=6330,
|
||||
Subarray(subarray_number=12, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=6350,
|
||||
start_row=1530, size=54, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=8, column_count=8),
|
||||
Subarray(subarray_number=13, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=4201,
|
||||
Subarray(subarray_number=13, origin=Coordinate(0, 0), required_seismic_anchors=0, weight=4239,
|
||||
start_row=1584, size=48, column_counted_geometrically=False, row_counted_geometrically=False,
|
||||
row_count=6, column_count=8)
|
||||
]
|
||||
@@ -140,15 +140,15 @@ class CalculatorTest(unittest.TestCase):
|
||||
self.subject = Calculator(self.values)
|
||||
|
||||
received_values = self.subject.summary_values()
|
||||
|
||||
|
||||
expected_values = array([
|
||||
{'label': 'Total System Weight (lbs)', 'value': 2684},
|
||||
{'label': 'Max PSF', 'value': 8.03},
|
||||
{'label': 'Avg PSF', 'value': 5.39},
|
||||
{'label': 'Total System Weight (lbs)', 'value': 2694},
|
||||
{'label': 'Max PSF', 'value': 7.9},
|
||||
{'label': 'Avg PSF', 'value': 5.41},
|
||||
{'label': 'Total Anchors', 'value': 5},
|
||||
{'label': 'Total Ballast', 'value': 131},
|
||||
{'label': 'Max Possible System Weight', 'value': 2789.0},
|
||||
{'label': 'Max System Weight Ballast Block', 'value': 16},
|
||||
{'label': 'Total Ballast', 'value': 135},
|
||||
{'label': 'Max Possible System Weight', 'value': 2792.0},
|
||||
{'label': 'Max System Weight Ballast Block', 'value': 17},
|
||||
{'label': 'Seismic Anchor Max. Spacing', 'value': 12},
|
||||
])
|
||||
assert_array_equal(received_values, expected_values)
|
||||
@@ -173,13 +173,13 @@ class CalculatorTest(unittest.TestCase):
|
||||
received_values = self.subject.documentation_summary_values()
|
||||
|
||||
expected_values = {
|
||||
'total_system_weight': 2684,
|
||||
'max_psf': 8.03,
|
||||
'ave_psf': 5.39,
|
||||
'total_system_weight': 2694,
|
||||
'max_psf': 7.9,
|
||||
'ave_psf': 5.41,
|
||||
'total_anchors': 5,
|
||||
'total_ballast': 131,
|
||||
'max_possible_system_weight': 2789.0,
|
||||
'max_system_weight_ballast_block': 16,
|
||||
'total_ballast': 135,
|
||||
'max_possible_system_weight': 2792.0,
|
||||
'max_system_weight_ballast_block': 17,
|
||||
'seismic_anchor_max_spacing': 12
|
||||
}
|
||||
eq_(received_values, expected_values)
|
||||
@@ -326,6 +326,8 @@ class CalculatorTest(unittest.TestCase):
|
||||
expected_csv = expected_file.read()
|
||||
reader = csv.reader(expected_csv.splitlines(), dialect='excel-tab')
|
||||
expected = array([row for row in reader])
|
||||
print("EXPECTED")
|
||||
print(expected)
|
||||
|
||||
power_station_1 = PowerStation(
|
||||
description='1',
|
||||
@@ -367,6 +369,8 @@ class CalculatorTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
self.site.power_stations = [power_station_1, power_station_2]
|
||||
print("COMPUTE")
|
||||
print(self.subject.compute_bom())
|
||||
assert_array_equal(self.subject.compute_bom(), expected)
|
||||
|
||||
def test_documentation_bom(self):
|
||||
@@ -404,91 +408,90 @@ class CalculatorTest(unittest.TestCase):
|
||||
self.site.cad_file = csv_content
|
||||
self.subject = Calculator(self.values)
|
||||
|
||||
expected = [
|
||||
('104813', 50),
|
||||
('105317', 0),
|
||||
('106925', 50),
|
||||
('107538', 0),
|
||||
('107549', 100),
|
||||
('107551', 50),
|
||||
('107586', 100),
|
||||
('111147', 0),
|
||||
('114961', 50),
|
||||
('507985', 0),
|
||||
('512021', 9),
|
||||
('512199', 140),
|
||||
('512200', 3480),
|
||||
('512510', 196),
|
||||
('512511', 196),
|
||||
('512575', 1),
|
||||
('512660', 2),
|
||||
('512661', 2),
|
||||
('512662', 4),
|
||||
('512663', 2),
|
||||
('523923', 0),
|
||||
('512910', 1),
|
||||
('513007', 50),
|
||||
('513299', 0),
|
||||
('513300', 0),
|
||||
('513301', 0),
|
||||
('513302', 0),
|
||||
('513303', 1),
|
||||
('513304', 0),
|
||||
('513586', 0),
|
||||
('513831', 0),
|
||||
('513832', 0),
|
||||
('513833', 670),
|
||||
('513836', 0),
|
||||
('513843', 262),
|
||||
('513844', 214),
|
||||
('514056', 1000),
|
||||
('514057', 1000),
|
||||
('514265', 179),
|
||||
('514435', 0),
|
||||
('514436', 0),
|
||||
('514437', 2),
|
||||
('514438', 2),
|
||||
('514439', 0),
|
||||
('514440', 0),
|
||||
('514477', 2),
|
||||
('514478', 0),
|
||||
('523924', 0),
|
||||
('523921', 1),
|
||||
('523922', 0),
|
||||
('514697', 1),
|
||||
('514698', 1),
|
||||
('514865', 50),
|
||||
('515059', 2),
|
||||
('515063', 4000),
|
||||
('515928', 261),
|
||||
('515929', 0),
|
||||
('516043', 0),
|
||||
('516045', 0),
|
||||
('517463', 0),
|
||||
('517871', 139),
|
||||
('518058', 2),
|
||||
('518059', 0),
|
||||
('518331', 2),
|
||||
('518477', 275),
|
||||
('519008', 0),
|
||||
('520301', 0),
|
||||
('520302', 0),
|
||||
('520303', 0),
|
||||
('520306', 0),
|
||||
('521031', 2),
|
||||
('521363', 0),
|
||||
('521797', 0),
|
||||
('521798', 0),
|
||||
('522020', 0),
|
||||
('805615', 2),
|
||||
('521794', 196),
|
||||
('521795', 196),
|
||||
|
||||
('anchors', 262),
|
||||
('ballast', 6786),
|
||||
('modules', 1726)
|
||||
]
|
||||
expected = [('521794', 196),
|
||||
('521795', 196),
|
||||
('514056', 1000),
|
||||
('modules', 1726),
|
||||
('513843', 263),
|
||||
('anchors', 263),
|
||||
('518477', 275),
|
||||
('513833', 670),
|
||||
('513844', 214),
|
||||
('ballast', 6777),
|
||||
('515928', 261),
|
||||
('517871', 139),
|
||||
('514057', 1000),
|
||||
('515063', 4000),
|
||||
('512200', 3480),
|
||||
('514265', 179),
|
||||
('513303', 1),
|
||||
('512660', 2),
|
||||
('512661', 2),
|
||||
('512662', 4),
|
||||
('512663', 2),
|
||||
('518331', 2),
|
||||
('518058', 2),
|
||||
('104813', 50),
|
||||
('107551', 50),
|
||||
('514865', 50),
|
||||
('106925', 50),
|
||||
('523921', 1),
|
||||
('514438', 2),
|
||||
('514437', 2),
|
||||
('512910', 1),
|
||||
('805615', 2),
|
||||
('521031', 2),
|
||||
('512575', 1),
|
||||
('514698', 1),
|
||||
('513007', 50),
|
||||
('114961', 50),
|
||||
('107549', 100),
|
||||
('107586', 100),
|
||||
('512021', 9),
|
||||
('512199', 140),
|
||||
('512511', 196),
|
||||
('512510', 196),
|
||||
('515929', 0),
|
||||
('514477', 2),
|
||||
('515059', 2),
|
||||
('514697', 1),
|
||||
('513831', 0),
|
||||
('513836', 0),
|
||||
('520301', 0),
|
||||
('520302', 0),
|
||||
('520303', 0),
|
||||
('520306', 0),
|
||||
('513832', 0),
|
||||
('514435', 0),
|
||||
('514436', 0),
|
||||
('514439', 0),
|
||||
('514440', 0),
|
||||
('523922', 0),
|
||||
('523923', 0),
|
||||
('523924', 0),
|
||||
('513299', 0),
|
||||
('513301', 0),
|
||||
('514478', 0),
|
||||
('513300', 0),
|
||||
('513302', 0),
|
||||
('513304', 0),
|
||||
('519008', 0),
|
||||
('518059', 0),
|
||||
('105317', 0),
|
||||
('111147', 0),
|
||||
('107538', 0),
|
||||
('516045', 0),
|
||||
('516043', 0),
|
||||
('513586', 0),
|
||||
('507985', 0),
|
||||
('522020', 0),
|
||||
('521798', 0),
|
||||
('521797', 0),
|
||||
('521363', 0),
|
||||
('517463', 0)]
|
||||
|
||||
print("===")
|
||||
print(self.subject.documentation_bom())
|
||||
assert_array_equal(sorted(self.subject.documentation_bom()), sorted(expected))
|
||||
|
||||
# Performance Tests
|
||||
|
||||
Reference in New Issue
Block a user