def test_idfstr(): """Test all outputtype options in IDF.idfstr(). """ idf = IDF() idf.initreadtxt(idfsnippet) assert idf.outputtype == 'standard' # start with the default original = idf.idfstr() assert "!-" in original # has comment assert "\n" in original # has line break assert "\n\n" in original # has empty line idf.outputtype = 'standard' s = idf.idfstr() assert "!-" in s # has comment assert "\n" in s # has line break assert "\n\n" in s # has empty line assert s == original # is unchanged idf.outputtype = 'nocomment' s = idf.idfstr() assert "!-" not in s # has no comments assert "\n" in s # has line break assert "\n\n" in s # has empty line assert s != original # is changed idf.outputtype = 'nocomment1' s = idf.idfstr() assert "!-" not in s # has no comments assert "\n" in s # has line break assert "\n\n" in s # has empty lines assert s != original # is changed idf.outputtype = 'nocomment2' s = idf.idfstr() assert "!-" not in s # has no comments assert "\n" in s # has line break assert "\n\n" not in s # has no empty lines assert s != original # is changed idf.outputtype = 'compressed' s = idf.idfstr() assert "!-" not in s # has no comments assert "\n" not in s # has no line breaks assert "\n\n" not in s # has no empty lines assert s != original # is changed
BuildingSurface:Detailed, z2 Roof 0001, !- Name Roof, !- Surface Type , !- Construction Name Thermal Zone 2, !- Zone Name Outdoors, !- Outside Boundary Condition , !- Outside Boundary Condition Object SunExposed, !- Sun Exposure WindExposed, !- Wind Exposure , !- View Factor to Ground , !- Number of Vertices 0.0, !- Vertex 1 Xcoordinate 0.0, !- Vertex 1 Ycoordinate 1.458, !- Vertex 1 Zcoordinate 0.0, !- Vertex 2 Xcoordinate 2.9, !- Vertex 2 Ycoordinate 1.458, !- Vertex 2 Zcoordinate -2.14, !- Vertex 3 Xcoordinate 2.9, !- Vertex 3 Ycoordinate 1.458, !- Vertex 3 Zcoordinate -2.14, !- Vertex 4 Xcoordinate 0.0, !- Vertex 4 Ycoordinate 1.458; !- Vertex 4 Zcoordinate """ idf = IDF() idf.initreadtxt(idftxt) idf.outputtype = "compressed" idf.printidf()
BuildingSurface:Detailed, z2 Roof 0001, !- Name Roof, !- Surface Type , !- Construction Name Thermal Zone 2, !- Zone Name Outdoors, !- Outside Boundary Condition , !- Outside Boundary Condition Object SunExposed, !- Sun Exposure WindExposed, !- Wind Exposure , !- View Factor to Ground , !- Number of Vertices 0.0, !- Vertex 1 Xcoordinate 0.0, !- Vertex 1 Ycoordinate 1.458, !- Vertex 1 Zcoordinate 0.0, !- Vertex 2 Xcoordinate 2.9, !- Vertex 2 Ycoordinate 1.458, !- Vertex 2 Zcoordinate -2.14, !- Vertex 3 Xcoordinate 2.9, !- Vertex 3 Ycoordinate 1.458, !- Vertex 3 Zcoordinate -2.14, !- Vertex 4 Xcoordinate 0.0, !- Vertex 4 Ycoordinate 1.458; !- Vertex 4 Zcoordinate """ idf = IDF() idf.initreadtxt(idftxt) idf.outputtype = 'compressed' idf.printidf()