4 Topics

Member Avatar for
Member Avatar for krystosan

I have a function in which i want to mock `os.listdir` that returns directory content to variable `dirContent` def setUp(self): self._filePaths = ["/test/file/path"] self.mox = mox.Mox() def imageFilePaths(paths): imagesWithPath = [] for _path in paths: try: dirContent = os.listdir(_path) except OSError: raise OSError("Provided path '%s' doesn't exists." % _path) for …

0
137
Member Avatar for krystosan

I have a source code that opens a csv file and sets up a header to value association. The source code is given below: def ParseCsvFile(source): """Parse the csv file. Args: source: file to be parsed. Returns: the list of dictionary entities; each dictionary contains attribute to value mapping or …

Member Avatar for chriswelborn
0
443
Member Avatar for krystosan

I have a method that does not return anything , but it makes a call to another method that returns a value like def apply(): #set some defaults try: script = _getScript() except Exception, ex: raise Exception(ex) node = [xyz for xyz in myLst] # myLst is a global list …

Member Avatar for krystosan
0
3K
Member Avatar for krystosan

in the code from mox example on their page [[http://code.google.com/p/pymox/wiki/MoxDocumentation](http://code.google.com/p/pymox/wiki/MoxDocumentation)] where does PersonDao comes from ? import unittest import mox class DaoUnitTest(unittest.TestCase): def setUp(self): # Create an instance of Mox self.person_mocker = mox.Mox() def testUsingMox(self): # Create a mock PersonDao dao = self.person_mocker.CreateMock(PersonDao) # Return a value when this method …

Member Avatar for krystosan
0
237

The End.