I want my code to work in Python 2 and 3. I use doctests and
from __future__ import unicode_literals
Is there a flag I can set / a plugin which makes it ignore that Python 2 has the u prefix for unicode strings?
Example
One test that works in Python 3, but fails in Python 2:
Expected:
'Me \\& you.'
Got:
u'Me \\& you.'
Minimal example
from __future__ import unicode_literals
def foo():
"""
Returns
-------
unicode - for Python 2 and Python 3
Examples
--------
>>> foo()
'bar'
"""
return 'bar'
if __name__ == '__main__':
import doctest
doctest.testmod()