def test_file_exists(self): '''Test example.path_exists() `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()` if you wanted. ''' self.assertFalse(example.path_exists('/test/empty.txt')) self.fs.CreateFile('/test/empty.txt') self.assertTrue(example.path_exists('/test/empty.txt'))
def test_file_exists(self): """Test example.path_exists() which uses `os.path.exists()`.""" self.assertFalse(example.path_exists('/test/empty.txt')) self.fs.CreateFile('/test/empty.txt') self.assertTrue(example.path_exists('/test/empty.txt'))