Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/prov/tests/test_json.py @ 2:6af9afd405e9 draft
"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
| author | shellac |
|---|---|
| date | Thu, 14 May 2020 14:56:58 -0400 |
| parents | 26e78fe6e8c4 |
| children |
comparison
equal
deleted
inserted
replaced
| 1:75ca89e9b81c | 2:6af9afd405e9 |
|---|---|
| 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' |
