示例#1
0
    def test_yaml_codec_raw(self):
        structured = {u'Test': [1, None, u'unicode ✓', {u'some': u'obj'}]}
        # Note: must use safe_dump, since regular dump adds !python/unicode
        # tags, which we don't want, or we can't be sure we're correctly
        # loading string as unicode.
        raw = yaml.safe_dump(structured)

        out = yaml_codec(raw, parameterized=False)
        self.assertEqual(structured, out)
示例#2
0
    def test_yaml_codec_raw(self):
        structured = {
            u'Test': [1, None, u'unicode ✓', {u'some': u'obj'}]
        }
        # Note: must use safe_dump, since regular dump adds !python/unicode
        # tags, which we don't want, or we can't be sure we're correctly
        # loading string as unicode.
        raw = yaml.safe_dump(structured)

        out = yaml_codec(raw, parameterized=False)
        self.assertEqual(structured, out)
示例#3
0
    def test_yaml_codec_parameterized(self):
        processed = {
            u'Test': Join(u'',
                          [u'Test ', {
                              u'Ref': u'Interpolation'
                          }, u' Here'])
        }
        structured = {u'Test': u'Test {{Interpolation}} Here'}
        raw = yaml.safe_dump(structured)

        out = yaml_codec(raw, parameterized=True)
        self.assertTemplateEqual(processed, out)
示例#4
0
    def test_yaml_codec_parameterized(self):
        processed = {
            u'Test': Join(u'', [u'Test ', {u'Ref': u'Interpolation'},
                          u' Here'])
        }
        structured = {
            u'Test': u'Test {{Interpolation}} Here'
        }
        raw = yaml.safe_dump(structured)

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