Skip to content

Commit cb5ced2

Browse files
authored
Add tests for hlp calc functions (#2)
seai_deap was broken when tried to impot... now has been tested and debugged
1 parent 3dc51e1 commit cb5ced2

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed

poetry.lock

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test_dim.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import numpy as np
2+
from numpy.testing import assert_array_equal
3+
4+
from seai_deap import dim
5+
6+
7+
def test_calculate_building_volume() -> None:
8+
9+
expected_output = np.array(4)
10+
11+
output = dim.calculate_building_volume(
12+
ground_floor_area=np.array(1),
13+
first_floor_area=np.array(1),
14+
second_floor_area=np.array(1),
15+
third_floor_area=np.array(1),
16+
ground_floor_height=np.array(1),
17+
first_floor_height=np.array(1),
18+
second_floor_height=np.array(1),
19+
third_floor_height=np.array(1),
20+
)
21+
22+
assert_array_equal(output, expected_output)
23+
24+
25+
def test_calculate_total_floor_area() -> None:
26+
27+
expected_output = np.array((4))
28+
29+
output = dim.calculate_total_floor_area(
30+
ground_floor_area=np.array(1),
31+
first_floor_area=np.array(1),
32+
second_floor_area=np.array(1),
33+
third_floor_area=np.array(1),
34+
)
35+
36+
assert_array_equal(output, expected_output)

tests/test_fab.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import numpy as np
2+
from numpy.testing import assert_array_equal
3+
4+
from seai_deap import fab
5+
6+
7+
def test_calculate_thermal_bridging() -> None:
8+
9+
expected_output = np.array(0.75)
10+
11+
output = fab.calculate_thermal_bridging(
12+
wall_area=np.array(1),
13+
roof_area=np.array(1),
14+
floor_area=np.array(1),
15+
window_area=np.array(1),
16+
door_area=np.array(1),
17+
thermal_bridging_factor=np.array(0.15),
18+
)
19+
20+
assert_array_equal(output, expected_output)
21+

tests/test_vent.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import numpy as np
2+
from numpy.testing import assert_array_equal
3+
4+
from seai_deap import vent
5+
6+
7+
def test_calculate_ventilation_heat_loss() -> None:
8+
9+
expected_output = np.array(0.165)
10+
11+
output = vent.calculate_ventilation_heat_loss(volume=np.array(1))
12+
13+
assert_array_equal(output, expected_output)

0 commit comments

Comments
 (0)