Пример #1
0
    def test_json_codec_raw(self):
        """Test json codec raw."""
        structured = {u'Test': [1, None, u'str', {u'some': u'obj'}]}
        raw = json.dumps(structured)

        out = json_codec(raw, parameterized=False)
        self.assertEqual(structured, out)
Пример #2
0
    def test_json_codec_raw(self) -> None:
        """Test json codec raw."""
        structured = {"Test": [1, None, "str", {"some": "obj"}]}
        raw = json.dumps(structured)

        out = json_codec(raw, parameterized=False)
        self.assertEqual(structured, out)
Пример #3
0
    def test_json_codec_parameterized(self) -> None:
        """Test json codec parameterized."""
        processed = {"Test": Join("", ["Test ", {"Ref": "Interpolation"}, " Here"])}
        structured = {"Test": "Test {{Interpolation}} Here"}
        raw = json.dumps(structured)

        out = json_codec(raw, parameterized=True)
        self.assertTemplateEqual(processed, out)
Пример #4
0
    def test_json_codec_parameterized(self):
        """Test json codec parameterized."""
        processed = {
            u'Test': Join(u'',
                          [u'Test ', {
                              u'Ref': u'Interpolation'
                          }, u' Here'])
        }
        structured = {u'Test': u'Test {{Interpolation}} Here'}
        raw = json.dumps(structured)

        out = json_codec(raw, parameterized=True)
        self.assertTemplateEqual(processed, out)