comparison planemo/lib/python3.7/site-packages/prov/tests/test_json.py @ 1:56ad4e20f292 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:32:28 -0400
parents
children
comparison
equal deleted inserted replaced
0:d30785e31577 1:56ad4e20f292
1 from __future__ import (absolute_import, division, print_function,
2 unicode_literals)
3
4 import unittest
5 from prov.model import ProvDocument
6 from prov.tests.utility import RoundTripTestCase
7 from prov.tests.test_model import AllTestsBase
8
9 import logging
10 logger = logging.getLogger(__name__)
11
12
13 class TestJSONSerializer(unittest.TestCase):
14 def test_decoding_unicode_value(self):
15 unicode_char = u'\u2019'
16 json_content = u'''{
17 "prefix": {
18 "ex": "http://www.example.org"
19 },
20 "entity": {
21 "ex:unicode_char": {
22 "prov:label": "%s"
23 }
24 }
25 }''' % unicode_char
26
27 prov_doc = ProvDocument.deserialize(
28 content=json_content, format='json'
29 )
30 e1 = prov_doc.get_record('ex:unicode_char')[0]
31 self.assertIn(unicode_char, e1.get_attribute('prov:label'))
32
33
34 class RoundTripJSONTests(RoundTripTestCase, AllTestsBase):
35 FORMAT = 'json'