def test_invalid_idd_obj_lookup(self): idd_object = """ !IDD_Version 1.2.0 !IDD_BUILD abcdef0100 \\group Stuff Version,A1; """ processor = IDDProcessor() ret_value = processor.process_file_via_stream( StringIO.StringIO(idd_object)) bad_obj = ret_value.get_object_by_type("noObjecT") self.assertIsNone(bad_obj)
def test_single_line_obj_lookup(self): idd_object = """ !IDD_Version 1.2.0 !IDD_BUILD abcdef0011 Simulation Input; \\group Stuff Version,A1; """ processor = IDDProcessor() ret_value = processor.process_file_via_stream( StringIO.StringIO(idd_object)) bad_obj = ret_value.get_object_by_type("simulation input") self.assertTrue(bad_obj)
def test_proper_idd_indented(self): idd_object = """ !IDD_Version 1.2.0 !IDD_BUILD abcdef0001 \\group Simulation Parameters Version, \\memo Specifies the EnergyPlus version of the IDF file. \\unique-object \format singleLine A1 ; \\field Version Identifier \\default 8.6 """ processor = IDDProcessor() ret_value = processor.process_file_via_stream( StringIO.StringIO(idd_object)) self.assertEquals(1, len(ret_value.groups)) self.assertEquals(1, len(ret_value.groups[0].objects))
def test_new_reference_class_name(self): idd_object = """ !IDD_Version 0.1.4 !IDD_BUILD abcded0810 \\group Simulation Parameters NewObject, A1; \\field Name \\required-field \\type alpha \\reference-class-name validBranchEquipmentTypes \\reference validBranchEquipmentNames """ processor = IDDProcessor() ret_value = processor.process_file_via_stream( StringIO.StringIO(idd_object)) self.assertEquals(1, len(ret_value.groups)) self.assertEquals(1, len(ret_value.groups[0].objects)) version_obj = ret_value.get_object_by_type("NewObject") self.assertEquals(1, len(version_obj.fields))
def test_repeated_object_meta_idd(self): idd_object = """ !IDD_Version 0.1.0 !IDD_BUILD abcdef0010 \\group Simulation Parameters Version, \\memo Specifies the EnergyPlus version of the IDF file. \\memo Some additional memo line \\unique-object \\format singleLine A1 ; \\field Version Identifier \\default 8.6 """ processor = IDDProcessor() ret_value = processor.process_file_via_stream( StringIO.StringIO(idd_object)) self.assertEquals(1, len(ret_value.groups)) self.assertEquals(1, len(ret_value.groups[0].objects)) version_obj = ret_value.get_object_by_type("version") self.assertEquals(1, len(version_obj.fields))