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)
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)
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)
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)