I\'m writing a doctest for a function that outputs a dictionary. The doctest looks like
>>> my_function() {\'this\': \'is\', \'a\': \'dictionary\'}
I ended up using this. Hacky, but it works.
>>> p = my_function() >>> {'this': 'is', 'a': 'dictionary'} == p True