From 248e89a666be55c32f4dd206b5b2994da7b5734e Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Tue, 31 Jan 2017 15:43:46 +0100 Subject: [PATCH] unicode tests uses serialize() and includes info about unicode symbol --- tests/db/test_bigchain_api.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/db/test_bigchain_api.py b/tests/db/test_bigchain_api.py index aa8488c4..129b77c4 100644 --- a/tests/db/test_bigchain_api.py +++ b/tests/db/test_bigchain_api.py @@ -1226,11 +1226,15 @@ def test_cant_spend_same_input_twice_in_tx(b, genesis_block): @pytest.mark.bdb def test_transaction_unicode(b): - import json + from bigchaindb.common.utils import serialize from bigchaindb.models import Transaction - tx = (Transaction.create([b.me], [([b.me], 100)], - {'beer': '\N{BEER MUG}'}) + + # http://www.fileformat.info/info/unicode/char/1f37a/index.htm + beer_python = {'beer': '\N{BEER MUG}'} + beer_json = '{"beer":"\N{BEER MUG}"}' + + tx = (Transaction.create([b.me], [([b.me], 100)], beer_python) ).sign([b.me_private]) block = b.create_block([tx]) assert block.validate(b) == block - assert '{"beer": "\\ud83c\\udf7a"}' in json.dumps(block.to_dict()) + assert beer_json in serialize(block.to_dict())