Skip to content

Commit 21e399f

Browse files
committed
Throw big diffs for size errors and if a table goes missing
1 parent 132aa5e commit 21e399f

5 files changed

Lines changed: 219 additions & 3 deletions

File tree

energyplus_regressions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
NAME = 'energyplus_regressions'
2-
VERSION = '2.1.4'
2+
VERSION = '2.1.5'

energyplus_regressions/diffs/table_diff.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ def table_diff(
467467
if uheading1 not in uhset_match:
468468
table_not_in_2 = 1
469469
count_of_not_in_2 += table_not_in_2
470+
table_big_diff = 1
471+
count_of_big_diff += table_big_diff
470472
make_err_table_row(err_soup, tabletag, uheading1, count_of_tables, abs_diff_file, rel_diff_file,
471473
table_small_diff, table_big_diff, table_equal, table_string_diff, table_size_error,
472474
table_not_in_1, table_not_in_2)
@@ -479,6 +481,8 @@ def table_diff(
479481
if len(table1('tr')) != len(table2('tr')) or len(table1('td')) != len(table2('td')):
480482
table_size_error = 1
481483
count_of_size_error += table_size_error
484+
table_big_diff = 1
485+
count_of_big_diff += table_big_diff
482486
make_err_table_row(err_soup, tabletag, uheading1, count_of_tables, abs_diff_file, rel_diff_file,
483487
table_small_diff, table_big_diff, table_equal, table_string_diff, table_size_error,
484488
table_not_in_1, table_not_in_2)
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2+
<html>
3+
<head>
4+
<title> Bldg DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB **
5+
2018-11-20
6+
17:26:37
7+
- EnergyPlus</title>
8+
</head>
9+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
10+
<body>
11+
<p><a href="#toc" style="float: right">Table of Contents</a></p>
12+
<a name=top></a>
13+
<p>Program Version:<b>EnergyPlus, Version 9.0.1-a7c9cc14ce, YMD=2018.11.20 17:26</b></p>
14+
<p>Tabular Output Report in Format: <b>HTML</b></p>
15+
<p>Building: <b>Bldg</b></p>
16+
<p>Environment: <b>DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB ** </b></p>
17+
<p>Simulation Timestamp: <b>2018-11-20
18+
17:26:37</b></p>
19+
<hr>
20+
<p><a href="#toc" style="float: right">Table of Contents</a></p>
21+
<a name=AnnualBuildingUtilityPerformanceSummary::EntireFacility></a>
22+
<p>Report:<b> Annual Building Utility Performance Summary</b></p>
23+
<p>For:<b> Entire Facility</b></p>
24+
<p>Timestamp: <b>2018-11-20
25+
17:26:37</b></p>
26+
<b>Values gathered over 0.00 hours</b><br><br>
27+
<b>WARNING: THE REPORT DOES NOT REPRESENT A FULL ANNUAL SIMULATION.</b><br><br>
28+
<b></b><br><br>
29+
<b>Site and Source Energy</b><br><br>
30+
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Site and Source Energy-->
31+
<table border="1" cellpadding="4" cellspacing="0">
32+
<tr><td></td>
33+
<td align="right">Total Energy [GJ]</td>
34+
<td align="right">Energy Per Total Building Area [MJ/m2]</td>
35+
<td align="right">Energy Per Conditioned Building Area [MJ/m2]</td>
36+
</tr>
37+
<tr>
38+
<td align="right">Total Site Energy</td>
39+
<td align="right"> 0.00</td>
40+
<td align="right"> 0.00</td>
41+
<td align="right"> 0.00</td>
42+
</tr>
43+
<tr>
44+
<td align="right">Net Site Energy</td>
45+
<td align="right"> 0.00</td>
46+
<td align="right"> 0.00</td>
47+
<td align="right"> 0.00</td>
48+
</tr>
49+
<tr>
50+
<td align="right">Total Source Energy</td>
51+
<td align="right"> 0.00</td>
52+
<td align="right"> 0.00</td>
53+
<td align="right"> 0.00</td>
54+
</tr>
55+
<tr>
56+
<td align="right">Net Source Energy</td>
57+
<td align="right"> 0.00</td>
58+
<td align="right"> 0.00</td>
59+
<td align="right"> 0.00</td>
60+
</tr>
61+
</table>
62+
<br><br>
63+
<b>Site to Source Energy Conversion Factors</b><br><br>
64+
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Site to Source Energy Conversion Factors-->
65+
<table border="1" cellpadding="4" cellspacing="0">
66+
<tr><td></td>
67+
<td align="right">Site=>Source Conversion Factor</td>
68+
</tr>
69+
<tr>
70+
<td align="right">Electricity</td>
71+
<td align="right"> 3.167</td>
72+
</tr>
73+
<tr>
74+
<td align="right">Natural Gas</td>
75+
<td align="right"> 1.084</td>
76+
</tr>
77+
</table>
78+
<br><br>
79+
<b>Building Area</b><br><br>
80+
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Building Area-->
81+
<table border="1" cellpadding="4" cellspacing="0">
82+
<tr><td></td>
83+
<td align="right">Area [m2]</td>
84+
</tr>
85+
<tr>
86+
<td align="right">Total Building Area</td>
87+
<td align="right"> 232.26</td>
88+
</tr>
89+
<tr>
90+
<td align="right">Net Conditioned Building Area</td>
91+
<td align="right"> 232.26</td>
92+
</tr>
93+
<tr>
94+
<td align="right">Unconditioned Building Area</td>
95+
<td align="right"> 0.00</td>
96+
</tr>
97+
</table>
98+
<br><br>
99+
</body>
100+
</html>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2+
<html>
3+
<head>
4+
<title> Bldg DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB **
5+
2018-11-20
6+
17:26:37
7+
- EnergyPlus</title>
8+
</head>
9+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
10+
<body>
11+
<p><a href="#toc" style="float: right">Table of Contents</a></p>
12+
<a name=top></a>
13+
<p>Program Version:<b>EnergyPlus, Version 9.0.1-a7c9cc14ce, YMD=2018.11.20 17:26</b></p>
14+
<p>Tabular Output Report in Format: <b>HTML</b></p>
15+
<p>Building: <b>Bldg</b></p>
16+
<p>Environment: <b>DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB ** </b></p>
17+
<p>Simulation Timestamp: <b>2018-11-20
18+
17:26:37</b></p>
19+
<hr>
20+
<p><a href="#toc" style="float: right">Table of Contents</a></p>
21+
<a name=AnnualBuildingUtilityPerformanceSummary::EntireFacility></a>
22+
<p>Report:<b> Annual Building Utility Performance Summary</b></p>
23+
<p>For:<b> Entire Facility</b></p>
24+
<p>Timestamp: <b>2018-11-20
25+
17:26:37</b></p>
26+
<b>Values gathered over 0.00 hours</b><br><br>
27+
<b>WARNING: THE REPORT DOES NOT REPRESENT A FULL ANNUAL SIMULATION.</b><br><br>
28+
<b></b><br><br>
29+
<b>Site and Source Energy</b><br><br>
30+
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Site and Source Energy-->
31+
<table border="1" cellpadding="4" cellspacing="0">
32+
<tr><td></td>
33+
<td align="right">Total Energy [GJ]</td>
34+
<td align="right">Energy Per Total Building Area [MJ/m2]</td>
35+
<td align="right">Energy Per Conditioned Building Area [MJ/m2]</td>
36+
</tr>
37+
<tr>
38+
<td align="right">Total Site Energy</td>
39+
<td align="right"> 0.00</td>
40+
<td align="right"> 0.00</td>
41+
<td align="right"> 0.00</td>
42+
</tr>
43+
<tr>
44+
<td align="right">Net Site Energy</td>
45+
<td align="right"> 0.00</td>
46+
<td align="right"> 0.00</td>
47+
<td align="right"> 0.00</td>
48+
</tr>
49+
<tr>
50+
<td align="right">Total Source Energy</td>
51+
<td align="right"> 0.00</td>
52+
<td align="right"> 0.00</td>
53+
<td align="right"> 0.00</td>
54+
</tr>
55+
<tr>
56+
<td align="right">Net Source Energy</td>
57+
<td align="right"> 0.00</td>
58+
<td align="right"> 0.00</td>
59+
<td align="right"> 0.00</td>
60+
</tr>
61+
</table>
62+
<br><br>
63+
<b>Site to Source Energy Conversion Factors</b><br><br>
64+
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Site to Source Energy Conversion Factors-->
65+
<table border="1" cellpadding="4" cellspacing="0">
66+
<tr><td></td>
67+
<td align="right">Site=>Source Conversion Factor</td>
68+
</tr>
69+
<tr>
70+
<td align="right">Electricity</td>
71+
<td align="right"> 3.167</td>
72+
</tr>
73+
<tr>
74+
<td align="right">Natural Gas</td>
75+
<td align="right"> 1.084</td>
76+
</tr>
77+
</table>
78+
<br><br>
79+
<b>Building Area</b><br><br>
80+
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Building Area-->
81+
<table border="1" cellpadding="4" cellspacing="0">
82+
<tr><td></td>
83+
<td align="right">Area [m2]</td>
84+
</tr>
85+
<tr>
86+
<td align="right">None</td>
87+
<td align="right"></td>
88+
</tr>
89+
</table>
90+
<br><br>
91+
</body>
92+
</html>

energyplus_regressions/tests/diffs/test_table_diff.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,26 @@ def test_skips_some_tables(self):
5454
self.assertEqual(0, response[7]) # in file 2 but not in file 1
5555
self.assertEqual(0, response[8]) # in file 1 but not in file 2
5656

57+
def test_mod_file_has_empty_table(self):
58+
response = table_diff(
59+
self.thresh_dict,
60+
os.path.join(self.diff_files_dir, 'eplustbl_empty_table_base.htm'),
61+
os.path.join(self.diff_files_dir, 'eplustbl_empty_table_mod.htm'),
62+
os.path.join(self.temp_output_dir, 'abs_diff.htm'),
63+
os.path.join(self.temp_output_dir, 'rel_diff.htm'),
64+
os.path.join(self.temp_output_dir, 'math_diff.log'),
65+
os.path.join(self.temp_output_dir, 'summary.htm'),
66+
)
67+
self.assertEqual('', response[0]) # diff status
68+
self.assertEqual(3, response[1]) # count_of_tables
69+
self.assertEqual(1, response[2]) # big diffs
70+
self.assertEqual(0, response[3]) # small diffs
71+
self.assertEqual(14, response[4]) # equals
72+
self.assertEqual(0, response[5]) # string diffs
73+
self.assertEqual(1, response[6]) # size errors
74+
self.assertEqual(0, response[7]) # in file 2 but not in file 1
75+
self.assertEqual(0, response[8]) # in file 1 but not in file 2
76+
5777
def test_invalid_file_1(self):
5878
response = table_diff(
5979
self.thresh_dict,
@@ -106,7 +126,7 @@ def test_second_file_missing_a_table(self):
106126
)
107127
self.assertEqual('', response[0]) # diff status
108128
self.assertEqual(3, response[1]) # count_of_tables
109-
self.assertEqual(0, response[2]) # big diffs
129+
self.assertEqual(1, response[2]) # big diffs
110130
self.assertEqual(0, response[3]) # small diffs
111131
self.assertEqual(14, response[4]) # equals
112132
self.assertEqual(0, response[5]) # string diffs
@@ -146,7 +166,7 @@ def test_second_file_has_table_with_different_size(self):
146166
)
147167
self.assertEqual('', response[0]) # diff status
148168
self.assertEqual(3, response[1]) # count_of_tables
149-
self.assertEqual(0, response[2]) # big diffs
169+
self.assertEqual(1, response[2]) # big diffs
150170
self.assertEqual(0, response[3]) # small diffs
151171
self.assertEqual(14, response[4]) # equals
152172
self.assertEqual(0, response[5]) # string diffs

0 commit comments

Comments
 (0)