Commit ccfc728c by willmcgugan

Added a check to the MemoryFS constructor that throws a ValueError if file_factory is not callable

parent 307c3729
...@@ -196,6 +196,8 @@ class MemoryFS(FS): ...@@ -196,6 +196,8 @@ class MemoryFS(FS):
self.dir_entry_factory = DirEntry self.dir_entry_factory = DirEntry
self.file_factory = file_factory or MemoryFile self.file_factory = file_factory or MemoryFile
if not callable(self.file_factory):
raise ValueError("file_factory should be callable")
self.root = self._make_dir_entry('dir', 'root') self.root = self._make_dir_entry('dir', 'root')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment