+ def testSauvWriterGroupWithOneFamily(self):
+ """
+ This test checks an option for sauv writing. It is requested here to copy a group from a family if a group is lying on a single family.
+ """
+ import re
+ mfd=MEDLoaderDataForTest.buildAMEDFileDataWithGroupOnOneFamilyForSauv()
+ sauvFile = "mesh.sauv"
+ sw=SauvWriter.New()
+ sw.setMEDFileDS(mfd)
+ self.assertTrue(not sw.getCpyGrpIfOnASingleFamilyStatus())
+ sw.setCpyGrpIfOnASingleFamilyStatus(True)
+ self.assertTrue(sw.getCpyGrpIfOnASingleFamilyStatus())
+ sw.write(sauvFile)
+
+ f = open(sauvFile)
+ # String pattern for the header of the sub meshes record ("PILE" number, number of named objects, number of objects)
+ pattern_pile= re.compile(r'\sPILE\sNUMERO\s+(?P<number>[0-9]+)NBRE\sOBJETS\sNOMMES\s+(?P<nbnamed>[0-9]+)NBRE\sOBJETS\s+(?P<nbobjects>[0-9]+)')
+ # String pattern for a sub mesh header (cell type, number of components and three numbers)
+ pattern_header=re.compile(r'\s+(?P<type>[0-9]+)\s+(?P<nbsubs>[0-9]+)\s+[0-9]+\s+[0-9]+\s+[0-9]+')
+
+ nbobjects=0
+ line = f.readline()
+ while(line):
+ match_pile = pattern_pile.match(line)
+ if match_pile:
+ number=int(match_pile.group("number"))
+ if number == 1:
+ nbnamed=int(match_pile.group("nbnamed"))
+ nbobjects=int(match_pile.group("nbobjects"))
+ break
+ pass
+ line=f.readline()
+ pass