Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/prov/tests/test_json.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
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' |