Example #1
0
 def test_delete_file(self):
     """Test example.delete_file() which uses `os.remove()`."""
     self.fs.CreateFile('/test/full.txt',
                        contents='First line\n'
                                 'Second Line\n')
     self.assertTrue(os.path.exists('/test/full.txt'))
     example.delete_file('/test/full.txt')
     self.assertFalse(os.path.exists('/test/full.txt'))
Example #2
0
    def test_delete_file(self):
        '''Test example.delete_file()

        `self.fs.CreateFile()` is convenient because it automatically creates
        directories in the fake file system and allows you to specify the file
        contents.
        
        You could also use `open()` or `file()`.
        '''
        self.fs.CreateFile('/test/full.txt',
                           contents='First line\n'
                                    'Second Line\n')
        self.assertTrue(os.path.exists('/test/full.txt'))
        example.delete_file('/test/full.txt')
        self.assertFalse(os.path.exists('/test/full.txt'))
    def test_delete_file(self):
        '''Test example.delete_file()

        `self.fs.CreateFile()` is convenient because it automatically creates
        directories in the fake file system and allows you to specify the file
        contents.
        
        You could also use `open()` or `file()`.
        '''
        self.fs.CreateFile('/test/full.txt',
                           contents='First line\n'
                           'Second Line\n')
        self.assertTrue(os.path.exists('/test/full.txt'))
        example.delete_file('/test/full.txt')
        self.assertFalse(os.path.exists('/test/full.txt'))