Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/prov/tests/test_json.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
| author | shellac |
|---|---|
| date | Mon, 01 Jun 2020 08:59:25 -0400 |
| parents | 79f47841a781 |
| children |
comparison
equal
deleted
inserted
replaced
| 4:79f47841a781 | 5:9b1c78e6ba9c |
|---|---|
| 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' |
