Exemple #1
0
    def test_coding_valid(self):
        """ test Coding data type is correctly constructed """

        coding = "just a string to explain a code"

        resp = dt_coding(coding)
        if resp:
            # result = json.loads(resp)
            result = resp
            # print("\nCoding Result:%s" % result)

        self.assertEqual(resp, None)

        code_dict = {"display": coding}

        resp = dt_coding(code_dict)
        result = {}
        if resp:
            # result = json.loads(resp)
            result = resp
            # print("\nCoding Result:%s" % result)

        self.assertEqual(result['display'], coding)
    def test_coding_valid(self):
        """ test Coding data type is correctly constructed """

        coding = "just a string to explain a code"

        resp = dt_coding(coding)
        if resp:
            # result = json.loads(resp)
            result = resp
            # print("\nCoding Result:%s" % result)

        self.assertEqual(resp, None)

        code_dict = {"display": coding}

        resp = dt_coding(code_dict)
        result = {}
        if resp:
            # result = json.loads(resp)
            result = resp
            # print("\nCoding Result:%s" % result)

        self.assertEqual(result['display'], coding)
    def test_coding_valid_full(self):
        """ Test Coding returns a complete coding block """

        coding = {"display": "just a string to explain a code",
                  "system": "http://example.com/code/",
                  "version": "1.0",
                  "code": "<code>",
                  "userSelected": True}

        resp = dt_coding(coding)

        if resp:
            # result = json.loads(resp)
            result = resp
            # print("\nFull Code:%s" % result)
        else:
            result = {}

        self.assertEqual(result['system'], coding['system'])
        self.assertEqual(result['version'], coding['version'])
        self.assertEqual(result['code'], coding['code'])
        self.assertEqual(result['userSelected'], coding['userSelected'])
Exemple #4
0
    def test_coding_valid_full(self):
        """ Test Coding returns a complete coding block """

        coding = {
            "display": "just a string to explain a code",
            "system": "http://example.com/code/",
            "version": "1.0",
            "code": "<code>",
            "userSelected": True
        }

        resp = dt_coding(coding)

        if resp:
            # result = json.loads(resp)
            result = resp
            # print("\nFull Code:%s" % result)
        else:
            result = {}

        self.assertEqual(result['system'], coding['system'])
        self.assertEqual(result['version'], coding['version'])
        self.assertEqual(result['code'], coding['code'])
        self.assertEqual(result['userSelected'], coding['userSelected'])