Exemplo n.º 1
0
 def test_rio_to_unicode(self):
     uni_data = u'\N{KATAKANA LETTER O}'
     s = Stanza(foo=uni_data)
     unicode_str = s.to_unicode()
     self.assertEqual(u'foo: %s\n' % (uni_data,), unicode_str)
     new_s = rio.read_stanza_unicode(unicode_str.splitlines(True))
     self.assertEqual(uni_data, new_s.get('foo'))
Exemplo n.º 2
0
 def test_rio_to_unicode(self):
     uni_data = u'\N{KATAKANA LETTER O}'
     s = Stanza(foo=uni_data)
     unicode_str = s.to_unicode()
     self.assertEqual(u'foo: %s\n' % (uni_data, ), unicode_str)
     new_s = rio.read_stanza_unicode(unicode_str.splitlines(True))
     self.assertEqual(uni_data, new_s.get('foo'))
Exemplo n.º 3
0
 def test_nested_rio_unicode(self):
     uni_data = u'\N{KATAKANA LETTER O}'
     s = Stanza(foo=uni_data)
     parent_stanza = Stanza(child=s.to_unicode())
     raw_lines = parent_stanza.to_lines()
     self.assertEqual(['child: foo: ' + uni_data.encode('utf-8') + '\n',
                       '\t\n',
                      ], raw_lines)
     new_parent = read_stanza(raw_lines)
     child_text = new_parent.get('child')
     self.assertEqual(u'foo: %s\n' % uni_data, child_text)
     new_child = rio.read_stanza_unicode(child_text.splitlines(True))
     self.assertEqual(uni_data, new_child.get('foo'))
Exemplo n.º 4
0
 def test_nested_rio_unicode(self):
     uni_data = u'\N{KATAKANA LETTER O}'
     s = Stanza(foo=uni_data)
     parent_stanza = Stanza(child=s.to_unicode())
     raw_lines = parent_stanza.to_lines()
     self.assertEqual([
         'child: foo: ' + uni_data.encode('utf-8') + '\n',
         '\t\n',
     ], raw_lines)
     new_parent = read_stanza(raw_lines)
     child_text = new_parent.get('child')
     self.assertEqual(u'foo: %s\n' % uni_data, child_text)
     new_child = rio.read_stanza_unicode(child_text.splitlines(True))
     self.assertEqual(uni_data, new_child.get('foo'))