Signed-off-by: IWAMOTO Toshihiro <[email protected]>
---
ryu/tests/unit/lib/test_stringify.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/ryu/tests/unit/lib/test_stringify.py
b/ryu/tests/unit/lib/test_stringify.py
index 2ee85f5..2a6e167 100644
--- a/ryu/tests/unit/lib/test_stringify.py
+++ b/ryu/tests/unit/lib/test_stringify.py
@@ -15,6 +15,7 @@
# limitations under the License.
import base64
+import six
import unittest
from nose.tools import eq_
@@ -40,10 +41,15 @@ class Test_stringify(unittest.TestCase):
pass
def test_jsondict(self):
+ if six.PY3:
+ def b64encode(s):
+ return base64.b64encode(s).decode('ascii')
+ else:
+ b64encode = base64.b64encode
j = {'C1': {'a': 'QUFB', 'c': 'Q0ND'}}
- eq_(j['C1']['a'], base64.b64encode(b'AAA'))
- eq_(j['C1']['c'], base64.b64encode(b'CCC'))
- c = C1(a='AAA', c='CCC')
+ eq_(j['C1']['a'], b64encode(b'AAA'))
+ eq_(j['C1']['c'], b64encode(b'CCC'))
+ c = C1(a=b'AAA', c=b'CCC')
c2 = C1.from_jsondict(j['C1'])
eq_(c.__class__, c2.__class__)
eq_(c.__dict__, c2.__dict__)
--
2.1.4
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel