Add `test_surface_function`
into `test_bunch_subclass`
took some liberty to indent the idftxt so it can be folded in editor
# Copyright (c) 2012, 2020 Santosh Philip
+# Copyright (c) 2020 Cheng Cui
# =======================================================================
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
@@ -20,6 +21,7 @@ import eppy.bunchhelpers as bunchhelpers
from eppy.iddcurrent import iddcurrent
import eppy.idfreader as idfreader
from eppy.modeleditor import IDF
+from eppy.pytest_helpers import almostequal
# This test is ugly because I have to send file names and not able to send file handles
@@ -35,8 +37,21 @@ if IDF.getiddname() == None:
IDF.setiddname(iddfhandle)
# This test is ugly because I have to send file names and not able to send file handles
-idftxt = """Version,
- 6.0;
+idftxt = """Version,6.0;
+
+ Building,
+ building, !- Name
+ 45; !- North Axis {deg}
+
+ Zone,
+ West Zone, !- Name
+ 30, !- Direction of Relative North {deg}
+ 0, 0, 0; !- X,Y,Z {m}
+
+ GlobalGeometryRules,
+ UpperLeftCorner, !- Starting Vertex Position
+ CounterClockWise, !- Vertex Entry Direction
+ Relative; !- Coordinate System
BuildingSurface:Detailed,
Zn001:Wall001, !- Name
@@ -379,6 +394,7 @@ BuildingSurface:Detailed,
CLEAR 3MM, !- Outside Layer
AIR 13MM, !- Layer 2
CLEAR 3MM; !- Layer 3
+
"""
@@ -1093,3 +1109,15 @@ ScheduleTypeLimits,
sch = idf.idfobjects["ScheduleTypeLimits"][0]
result = sch.__repr__()
assert result == expected
+
+
+def test_surface_function():
+ fhandle = StringIO(idftxt)
+ idf = IDF(fhandle)
+ surface = idf.idfobjects["BuildingSurface:Detailed"][0]
+
+ # test the azimuth
+ assert almostequal(surface.azimuth, 180, places=3) == True
+
+ # test the true azimuth
+ assert almostequal(surface.true_azimuth, 255, places=3) == True
