FakeFileWrapper: How handle isinstance(ffw, io.BaseIO)
?
#896
Replies: 2 comments
-
Good question - currently this is not possible. From the documentation:
This came up before (hence the note in the limitations), and so far I have no solution for this. |
Beta Was this translation helpful? Give feedback.
-
I'm moving this to discussions. I once already attempted to refactor the code accordingly, but got nowhere, so it is unlikely that this behavior will be changed any time soon. |
Beta Was this translation helpful? Give feedback.
-
Out there in the world packages and functions exist that checking the type of an object to find out if iti s a file-like object or a path/pathname.
When I do
pathlib.Path('foobar').open()
in a PyFakeFS environment the result is aFakeFileWrapper
.It behaves like a file-like object it didn't pass type tests like this.
isinstance(file_object, io.BaseIO)
Now the question is how to handle that?
Beta Was this translation helpful? Give feedback.
All reactions