def test_utf8_conversion(self): value_unicode = u'fäké1' value_utf8 = value_unicode.encode('utf-8') result_utf8 = ks_ldap.utf8_encode(value_unicode) self.assertEqual(value_utf8, result_utf8) result_utf8 = ks_ldap.utf8_encode(value_utf8) self.assertEqual(value_utf8, result_utf8) result_unicode = ks_ldap.utf8_decode(value_utf8) self.assertEqual(value_unicode, result_unicode) result_unicode = ks_ldap.utf8_decode(value_unicode) self.assertEqual(value_unicode, result_unicode) self.assertRaises(TypeError, ks_ldap.utf8_encode, 100) result_unicode = ks_ldap.utf8_decode(100) self.assertEqual(u'100', result_unicode)
def test_utf8_conversion(self): value_unicode = u"fäké1" value_utf8 = value_unicode.encode("utf-8") result_utf8 = ks_ldap.utf8_encode(value_unicode) self.assertEqual(value_utf8, result_utf8) result_utf8 = ks_ldap.utf8_encode(value_utf8) self.assertEqual(value_utf8, result_utf8) result_unicode = ks_ldap.utf8_decode(value_utf8) self.assertEqual(value_unicode, result_unicode) result_unicode = ks_ldap.utf8_decode(value_unicode) self.assertEqual(value_unicode, result_unicode) self.assertRaises(TypeError, ks_ldap.utf8_encode, 100) result_unicode = ks_ldap.utf8_decode(100) self.assertEqual(u"100", result_unicode)