Пример #1
0
    def testValidInput(self):
        """
        Test if method works when given a valid file.
        """
        #create
        writeData = ("Trust me, I know what self-loathing is,"
                     "but to kill myself? That would put a damper on my "
                     "search for answers. Not at all productive.")
        # (C) Jhonen Vasquez - Johnny the Homicidal Maniac
        with temporaryPath(data=writeData) as path:
            #read
            readData = misc.readfile(path)

        self.assertEquals(writeData, readData[0])
Пример #2
0
    def testValidInput(self):
        """
        Test if method works when given a valid file.
        """
        #create
        writeData = ("Trust me, I know what self-loathing is,"
                     "but to kill myself? That would put a damper on my "
                     "search for answers. Not at all productive.")
        # (C) Jhonen Vasquez - Johnny the Homicidal Maniac
        fd, path = tempfile.mkstemp()
        f = os.fdopen(fd, "wb")
        f.write(writeData)
        f.close()

        #read
        readData = misc.readfile(path)

        #clean
        os.unlink(path)

        self.assertEquals(writeData, readData[0])