This is an example on how to mock a file with string.
Testing a function which opens a file and does some kind of operation on it.
Let us make a function which takes json from file and returns some data. In this example, we want to take data from this API and return name of each planet and its surface temperature in a list.
Instead of creating a mock file, we can limit ourselves to short string with only necessary information.
Example with @mock_patch
decorator and corresponding function are shown.