示例#1
0
 def test_yaml_render_old_unicode(self):
     config = {"use_yamlloader_old": True}
     with patch.dict(yaml.__opts__, config):  # pylint: disable=no-member
         self.assert_matches(
             yaml.render(
                 textwrap.dedent(
                     """\
                 foo:
                   a: Д
                   b: {'a': u'\\u0414'}"""
                 )
             ),
             {"foo": {"a": "\u0414", "b": {"a": "\u0414"}}},
         )
示例#2
0
 def test_yaml_render_old_unicode(self):
     config = {'use_yamlloader_old': True}
     with patch.dict(yaml.__opts__, config):  # pylint: disable=no-member
         self.assert_matches(
             yaml.render(
                 textwrap.dedent('''\
                 foo:
                   a: Д
                   b: {'a': u'\\u0414'}''')),
             {'foo': {
                 'a': u'\u0414',
                 'b': {
                     'a': u'\u0414'
                 }
             }})
示例#3
0
    def test_yaml_render_unicode(self):
        data = "!!python/unicode python unicode string"
        result = yaml.render(data)

        self.assertEqual(result, u"python unicode string")
示例#4
0
    def test_yaml_render_string(self):
        data = "string"
        result = yaml.render(data)

        self.assertEqual(result, data)
示例#5
0
def test_yaml_render_unicode():
    data = "!!python/unicode python unicode string"
    result = yaml.render(data)

    assert result == "python unicode string"
示例#6
0
def test_yaml_render_string():
    data = "string"
    result = yaml.render(data)

    assert result == data