Example #1
0
    def test_writeFileContents_validinput(self):
        import os
        import lowlevel

        contents = "AaAaba"

        lowlevel.writeFileContents(self.__dummy_file,contents)

        self.assertTrue(os.path.exists(self.__dummy_file))

        os.unlink(self.__dummy_file)
Example #2
0
    def test_writeFileContents_invalidinput(self):
        import lowlevel
        import sys

        contents = None
        path = self.__dummy_file
        with self.assertRaises(lowlevel.LowLevelException):
            lowlevel.writeFileContents(path,contents)

        contents = "AaAaba"
        path = None
        with self.assertRaises(lowlevel.LowLevelException):
            lowlevel.writeFileContents(path,contents)

        if sys.platform == "win32" or sys.platform == "win64":
            contents = "AaAaba"
            path = "c::\ffff:ffff"
            with self.assertRaises(lowlevel.LowLevelException):
                lowlevel.writeFileContents(path,contents)