text: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  #
  #  Generated from FHIR 3.0.0.11832 on 2017-03-22.
  #  2017, SMART Health IT.
  
  
  import io
  import json
  import os
  import unittest
  
  from . import researchsubject
  
  
  class ResearchSubjectTests(unittest.TestCase):
      def instantiate_from(self, filename):
          datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or ''
          with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle:
              js = json.load(handle)
              self.assertEqual("ResearchSubject", js["resourceType"])
          return researchsubject.ResearchSubject(js)
  
      def testResearchSubject1(self):
          inst = self.instantiate_from("researchsubject-example.json")
          self.assertIsNotNone(inst, "Must have instantiated a ResearchSubject instance")
          self.implResearchSubject1(inst)
  
          js = inst.as_json()
          self.assertEqual("ResearchSubject", js["resourceType"])
          inst2 = researchsubject.ResearchSubject(js)
          self.implResearchSubject1(inst2)
  
      def implResearchSubject1(self, inst):
          self.assertEqual(inst.id, "example")
          self.assertEqual(inst.identifier.system, "http://example.org/studysubjectids")
          self.assertEqual(inst.identifier.type.text, "Subject id")
          self.assertEqual(inst.identifier.value, "123")
          self.assertEqual(inst.status, "candidate")
          self.assertEqual(inst.text.div, "<div xmlns=\"http://www.w3.org/1999/xhtml\">[Put rendering here]</div>")
          self.assertEqual(inst.text.status, "generated")
  
  