Ejemplo n.º 1
0
 def testCollectfilesExistingSinglefileWrongNoMatchCriteria(self):
   """
   findfiles must not report any entry if the testfunc reports false for that
   file
   """
   txt_inner_iter = findfiles(self.txt_inner, testfunc = lambda p:False)
   self.assertRaises(StopIteration, txt_inner_iter.next)
Ejemplo n.º 2
0
 def testCollectfilesPopulatedDirectoryWrongExtension(self):
   """
   findfiles must not report any entry for the populated test directory if
   the extension parameter does not contain the correct extension of the
   testfile
   """
   txt_inner_iter = findfiles(self.pop_inner_tmpdir, testfunc = lambda p:False)
   self.assertRaises(StopIteration, txt_inner_iter.next)
Ejemplo n.º 3
0
 def testCollectfilesPopulatedDirectoryCorrectExtension(self):
   """
   findfiles must report one entry for the populated test directory if
   the extension parameter contains the txt extension.
   """
   txt_inner_iter = findfiles(self.pop_inner_tmpdir, testfunc = lambda p:True)
   self.assertEqual(self.txt_inner, txt_inner_iter.next())
   self.assertRaises(StopIteration, txt_inner_iter.next)
Ejemplo n.º 4
0
 def testCollectfilesExistingSinglefileMatchCriteria(self):
   """
   findfiles must return exactly one entry for a single file if the testfunc
   reports true for that file.
   """
   txt_inner_iter = findfiles(self.txt_inner, testfunc = lambda p:True)
   self.assertEqual(self.txt_inner, txt_inner_iter.next())
   self.assertRaises(StopIteration, txt_inner_iter.next)
Ejemplo n.º 5
0
 def testCollectfilesNonExistantPath(self):
   """
   findfiles must report an OSError for non-existant paths
   """
   txt_inner_iter = findfiles(os.path.join(self.empty_tmpdir,"nothing"))
   self.assertRaises(OSError, txt_inner_iter.next)
Ejemplo n.º 6
0
 def testCollectfilesPopulatedDirectory(self):
   """findfiles must report one entry for the populated test directory"""
   txt_inner_iter = findfiles(self.pop_inner_tmpdir)
   self.assertEqual(self.txt_inner, txt_inner_iter.next())
   self.assertRaises(StopIteration, txt_inner_iter.next)
Ejemplo n.º 7
0
 def testCollectfilesEmptyDirectory(self):
   """findfiles must not return any entry for empty directory"""
   for x in findfiles(self.empty_tmpdir):
     self.fail()
Ejemplo n.º 8
0
 def testCollectfilesExistingSinglefile(self):
   """findfiles must return exactly one entry for a single file"""
   txt_inner_iter = findfiles(self.txt_inner)
   self.assertEqual(self.txt_inner, txt_inner_iter.next())
   self.assertRaises(StopIteration, txt_inner_iter.next)