예제 #1
0
    def test_create_file(self):
        """Test example.create_file() which uses `open()` and `file.write()`."""
        self.assertFalse(os.path.isdir('/test'))
        os.mkdir('/test')
        self.assertTrue(os.path.isdir('/test'))

        self.assertFalse(os.path.exists('/test/file.txt'))
        example.create_file('/test/file.txt')
        self.assertTrue(os.path.exists('/test/file.txt'))
예제 #2
0
 def test_create_file(self):
     '''Test example.create_file()'''
     # The os module has been replaced with the fake os module so all of the
     # following occurs in the fake filesystem.
     self.assertFalse(os.path.isdir('/test'))
     os.mkdir('/test')
     self.assertTrue(os.path.isdir('/test'))
     
     self.assertFalse(os.path.exists('/test/file.txt'))
     example.create_file('/test/file.txt')
     self.assertTrue(os.path.exists('/test/file.txt'))
    def test_create_file(self):
        '''Test example.create_file()'''
        # The os module has been replaced with the fake os module so all of the
        # following occurs in the fake filesystem.
        self.assertFalse(os.path.isdir('/test'))
        os.mkdir('/test')
        self.assertTrue(os.path.isdir('/test'))

        self.assertFalse(os.path.exists('/test/file.txt'))
        example.create_file('/test/file.txt')
        self.assertTrue(os.path.exists('/test/file.txt'))