]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
python len(MEDFileFieldMultiTS)
authorageay <ageay>
Fri, 4 Jan 2013 11:14:13 +0000 (11:14 +0000)
committerageay <ageay>
Fri, 4 Jan 2013 11:14:13 +0000 (11:14 +0000)
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderTest3.py

index f99f6635bc14242c1ad22dcb2a702ff4d5083ac8..8dab9128151534276c0b42891205d7fedefd190f 100644 (file)
@@ -1207,9 +1207,14 @@ namespace ParaMEDMEM
          }
          
          std::string __str__() const throw(INTERP_KERNEL::Exception)
-           {
-             return self->simpleRepr();
-           }
+         {
+           return self->simpleRepr();
+         }
+
+         int __len__() const throw(INTERP_KERNEL::Exception)
+         {
+           return self->getNumberOfTS();
+         }
 
          MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
          {
index 891d19c11b474379c6aa9a71ca8ddcbd09d8b240..aee3876cb0f1d94b6088be946dbcf46128946996 100644 (file)
@@ -384,6 +384,7 @@ class MEDLoaderTest(unittest.TestCase):
         mm.write("Pyfile17_bis.med",2)
         ff=MEDFileFieldMultiTS("Pyfile17.med")
         tsExpected=[[1,2],[3,4],[5,6]]
+        self.assertEqual(3,len(ff))
         for pos,f1ts in enumerate(ff):
             self.assertEqual(tsExpected[pos],f1ts.getTime()[:2])
             self.assertEqual(type(f1ts),MEDFileField1TS)