Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
adding check for invalid cooling system types
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerket committed Mar 31, 2015
1 parent 94245e4 commit 9ceb4bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 6 additions & 3 deletions code/hpxml_to_hescore.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,12 @@ def _get_cooling_system_type(self, clgsys):
else:
assert clgsys.tag.endswith('CoolingSystem')
hpxml_cooling_type = xpath(clgsys, 'h:CoolingSystemType/text()')
sys_cooling['type'] = {'central air conditioning': 'split_dx',
'room air conditioner': 'packaged_dx',
'mini-split': 'split_dx'}[hpxml_cooling_type]
try:
sys_cooling['type'] = {'central air conditioning': 'split_dx',
'room air conditioner': 'packaged_dx',
'mini-split': 'split_dx'}[hpxml_cooling_type]
except KeyError:
raise TranslationError('HEScore does not support the HPXML CoolingSystemType %s' % hpxml_cooling_type)
# cooling efficiency
eff_units = {'split_dx': 'SEER',
'packaged_dx': 'EER',
Expand Down
10 changes: 9 additions & 1 deletion code/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,15 @@ def test_impossible_heating_system_type(self):
self.assertRaisesRegexp(TranslationError,
'HEScore does not support the HPXML HeatingSystemType',
tr.hpxml_to_hescore_dict)


def test_impossible_cooling_system_type(self):
tr = self._load_xmlfile('hescore_min')
el = self.xpath('//h:CoolingSystem[1]/h:CoolingSystemType')
el.text = 'evaporative cooler'
self.assertRaisesRegexp(TranslationError,
'HEScore does not support the HPXML CoolingSystemType',
tr.hpxml_to_hescore_dict)

def test_missing_heating_weighting_factor(self):
tr = self._load_xmlfile('house4')
el = self.xpath('//h:HeatingSystem[1]/h:HeatingCapacity')
Expand Down

0 comments on commit 9ceb4bf

Please sign in to comment.