Anshu Kumar writes:
> I need to mock file reader object , i tried using
> @patch('__builtin__.open') but it will patch my all file open readers.
For this reason I have written and published the Gajja library
https://pypi.python.org/pypi/gajja/>.
Its FileDouble objects will allow fine-grained co
Hi,
I need to mock file reader object , i tried using @patch('__builtin__.open')
but it will patch my all file open readers.
More precisely i have code something like below
def
restore_segments_and_lines_json(segments_file_path,lines_file_path,deleted_segment_ids):
with open(segments_file_p
Alex Kleider wrote:
> Some weeks (perhaps months) ago, I posted a question about testing
> and got many responses but had trouble grasping the concepts
> so I settled on the suggestion that I thought would be the easiest
> to implement (using unittest.mock.) Here it is-
>
> """
> from Peter Otten
Some weeks (perhaps months) ago, I posted a question about testing
and got many responses but had trouble grasping the concepts
so I settled on the suggestion that I thought would be the easiest
to implement (using unittest.mock.) Here it is-
"""
from Peter Otten:
I find Ben's example instructive