Commit 36539df2 authored by ChangBo Guo(gcb)'s avatar ChangBo Guo(gcb) Committed by ChangBo Guo(gcb)
Browse files

Add unit test for unicode in object __repr__

This adds a unit test for the behavior when an object has a unicode
string field. If on python 2, the repr is encoded to the default
encoding (ascii) before being returned. This is to ensure calls like
str(obj_repr) will work under python 2.

This patch also adjusts logic to make the code compatbile for Python 4.

[1] http://astrofrog.github.io/blog/2016/01/12/stop-writing-python-4-incompatible-code/



Co-Authored-By: default avatarmelanie witt <melwittt@gmail.com>
Change-Id: I65dd271ac2198b384d201349607e74992c447f75
parent dcb1c059