diff --git a/energyplus_regressions/__init__.py b/energyplus_regressions/__init__.py index c777832..27b5621 100644 --- a/energyplus_regressions/__init__.py +++ b/energyplus_regressions/__init__.py @@ -1,2 +1,2 @@ NAME = 'energyplus_regressions' -VERSION = '2.1.4' +VERSION = '2.1.5' diff --git a/energyplus_regressions/diffs/table_diff.py b/energyplus_regressions/diffs/table_diff.py index 1bf8fa4..c509270 100755 --- a/energyplus_regressions/diffs/table_diff.py +++ b/energyplus_regressions/diffs/table_diff.py @@ -467,6 +467,8 @@ def table_diff( if uheading1 not in uhset_match: table_not_in_2 = 1 count_of_not_in_2 += table_not_in_2 + table_big_diff = 1 + count_of_big_diff += table_big_diff make_err_table_row(err_soup, tabletag, uheading1, count_of_tables, abs_diff_file, rel_diff_file, table_small_diff, table_big_diff, table_equal, table_string_diff, table_size_error, table_not_in_1, table_not_in_2) @@ -479,6 +481,8 @@ def table_diff( if len(table1('tr')) != len(table2('tr')) or len(table1('td')) != len(table2('td')): table_size_error = 1 count_of_size_error += table_size_error + table_big_diff = 1 + count_of_big_diff += table_big_diff make_err_table_row(err_soup, tabletag, uheading1, count_of_tables, abs_diff_file, rel_diff_file, table_small_diff, table_big_diff, table_equal, table_string_diff, table_size_error, table_not_in_1, table_not_in_2) diff --git a/energyplus_regressions/tests/diffs/tbl_resources/eplustbl_empty_table_base.htm b/energyplus_regressions/tests/diffs/tbl_resources/eplustbl_empty_table_base.htm new file mode 100644 index 0000000..1ffc1ed --- /dev/null +++ b/energyplus_regressions/tests/diffs/tbl_resources/eplustbl_empty_table_base.htm @@ -0,0 +1,100 @@ + + + + Bldg DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB ** + 2018-11-20 + 17:26:37 + - EnergyPlus + + + +

Table of Contents

+ +

Program Version:EnergyPlus, Version 9.0.1-a7c9cc14ce, YMD=2018.11.20 17:26

+

Tabular Output Report in Format: HTML

+

Building: Bldg

+

Environment: DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB **

+

Simulation Timestamp: 2018-11-20 + 17:26:37

+
+

Table of Contents

+ +

Report: Annual Building Utility Performance Summary

+

For: Entire Facility

+

Timestamp: 2018-11-20 + 17:26:37

+Values gathered over 0.00 hours

+WARNING: THE REPORT DOES NOT REPRESENT A FULL ANNUAL SIMULATION.

+

+Site and Source Energy

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Total Energy [GJ]Energy Per Total Building Area [MJ/m2]Energy Per Conditioned Building Area [MJ/m2]
Total Site Energy 0.00 0.00 0.00
Net Site Energy 0.00 0.00 0.00
Total Source Energy 0.00 0.00 0.00
Net Source Energy 0.00 0.00 0.00
+

+Site to Source Energy Conversion Factors

+ + + + + + + + + + + + + +
Site=>Source Conversion Factor
Electricity 3.167
Natural Gas 1.084
+

+Building Area

+ + + + + + + + + + + + + + + + + +
Area [m2]
Total Building Area 232.26
Net Conditioned Building Area 232.26
Unconditioned Building Area 0.00
+

+ + diff --git a/energyplus_regressions/tests/diffs/tbl_resources/eplustbl_empty_table_mod.htm b/energyplus_regressions/tests/diffs/tbl_resources/eplustbl_empty_table_mod.htm new file mode 100644 index 0000000..649ebe7 --- /dev/null +++ b/energyplus_regressions/tests/diffs/tbl_resources/eplustbl_empty_table_mod.htm @@ -0,0 +1,92 @@ + + + + Bldg DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB ** + 2018-11-20 + 17:26:37 + - EnergyPlus + + + +

Table of Contents

+ +

Program Version:EnergyPlus, Version 9.0.1-a7c9cc14ce, YMD=2018.11.20 17:26

+

Tabular Output Report in Format: HTML

+

Building: Bldg

+

Environment: DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB **

+

Simulation Timestamp: 2018-11-20 + 17:26:37

+
+

Table of Contents

+ +

Report: Annual Building Utility Performance Summary

+

For: Entire Facility

+

Timestamp: 2018-11-20 + 17:26:37

+Values gathered over 0.00 hours

+WARNING: THE REPORT DOES NOT REPRESENT A FULL ANNUAL SIMULATION.

+

+Site and Source Energy

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Total Energy [GJ]Energy Per Total Building Area [MJ/m2]Energy Per Conditioned Building Area [MJ/m2]
Total Site Energy 0.00 0.00 0.00
Net Site Energy 0.00 0.00 0.00
Total Source Energy 0.00 0.00 0.00
Net Source Energy 0.00 0.00 0.00
+

+Site to Source Energy Conversion Factors

+ + + + + + + + + + + + + +
Site=>Source Conversion Factor
Electricity 3.167
Natural Gas 1.084
+

+Building Area

+ + + + + + + + + +
Area [m2]
None
+

+ + diff --git a/energyplus_regressions/tests/diffs/test_table_diff.py b/energyplus_regressions/tests/diffs/test_table_diff.py index 221354d..cd6999d 100644 --- a/energyplus_regressions/tests/diffs/test_table_diff.py +++ b/energyplus_regressions/tests/diffs/test_table_diff.py @@ -54,6 +54,26 @@ def test_skips_some_tables(self): self.assertEqual(0, response[7]) # in file 2 but not in file 1 self.assertEqual(0, response[8]) # in file 1 but not in file 2 + def test_mod_file_has_empty_table(self): + response = table_diff( + self.thresh_dict, + os.path.join(self.diff_files_dir, 'eplustbl_empty_table_base.htm'), + os.path.join(self.diff_files_dir, 'eplustbl_empty_table_mod.htm'), + os.path.join(self.temp_output_dir, 'abs_diff.htm'), + os.path.join(self.temp_output_dir, 'rel_diff.htm'), + os.path.join(self.temp_output_dir, 'math_diff.log'), + os.path.join(self.temp_output_dir, 'summary.htm'), + ) + self.assertEqual('', response[0]) # diff status + self.assertEqual(3, response[1]) # count_of_tables + self.assertEqual(1, response[2]) # big diffs + self.assertEqual(0, response[3]) # small diffs + self.assertEqual(14, response[4]) # equals + self.assertEqual(0, response[5]) # string diffs + self.assertEqual(1, response[6]) # size errors + self.assertEqual(0, response[7]) # in file 2 but not in file 1 + self.assertEqual(0, response[8]) # in file 1 but not in file 2 + def test_invalid_file_1(self): response = table_diff( self.thresh_dict, @@ -106,7 +126,7 @@ def test_second_file_missing_a_table(self): ) self.assertEqual('', response[0]) # diff status self.assertEqual(3, response[1]) # count_of_tables - self.assertEqual(0, response[2]) # big diffs + self.assertEqual(1, response[2]) # big diffs self.assertEqual(0, response[3]) # small diffs self.assertEqual(14, response[4]) # equals self.assertEqual(0, response[5]) # string diffs @@ -146,7 +166,7 @@ def test_second_file_has_table_with_different_size(self): ) self.assertEqual('', response[0]) # diff status self.assertEqual(3, response[1]) # count_of_tables - self.assertEqual(0, response[2]) # big diffs + self.assertEqual(1, response[2]) # big diffs self.assertEqual(0, response[3]) # small diffs self.assertEqual(14, response[4]) # equals self.assertEqual(0, response[5]) # string diffs