Python ctypes 模块,set_conversion_mode() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用ctypes.set_conversion_mode()

项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_buffers(self):
        ctypes.set_conversion_mode("ascii", "strict")
        buf = ctypes.create_unicode_buffer("abc")
        self.assertEqual(len(buf), 3+1)

        ctypes.set_conversion_mode("ascii", "replace")
        buf = ctypes.create_unicode_buffer("ab")
        self.assertEqual(buf[:], u"ab\uFFFD\uFFFD\uFFFD\0")
        self.assertEqual(buf[::], u"ab\uFFFD\uFFFD\uFFFD\0")
        self.assertEqual(buf[::-1], u"\0\uFFFD\uFFFD\uFFFDba")
        self.assertEqual(buf[::2], u"a\uFFFD\uFFFD")
        self.assertEqual(buf[6:5:-1], u"")

        ctypes.set_conversion_mode("ascii", "ignore")
        buf = ctypes.create_unicode_buffer("ab")
        # is that correct? not sure.  But with 'ignore', you get what you pay for..
        self.assertEqual(buf[:], u"ab\0\0\0\0")
        self.assertEqual(buf[::], u"ab\0\0\0\0")
        self.assertEqual(buf[::-1], u"\0\0\0\0ba")
        self.assertEqual(buf[::2], u"a\0\0")
        self.assertEqual(buf[6:5:-1], u"")
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_buffers(self):
        ctypes.set_conversion_mode("ascii", "strict")
        buf = ctypes.create_string_buffer(u"abc")
        self.assertEqual(len(buf), 3+1)

        ctypes.set_conversion_mode("ascii", "replace")
        buf = ctypes.create_string_buffer(u"ab")
        self.assertEqual(buf[:], "ab???\0")
        self.assertEqual(buf[::], "ab???\0")
        self.assertEqual(buf[::-1], "\0???ba")
        self.assertEqual(buf[::2], "a??")
        self.assertEqual(buf[6:5:-1], "")

        ctypes.set_conversion_mode("ascii", "ignore")
        buf = ctypes.create_string_buffer(u"ab")
        # is that correct? not sure.  But with 'ignore', you get what you pay for..
        self.assertEqual(buf[:], "ab\0\0\0\0")
        self.assertEqual(buf[::], "ab\0\0\0\0")
        self.assertEqual(buf[::-1], "\0\0\0\0ba")
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_buffers(self):
        ctypes.set_conversion_mode("ascii", "strict")
        buf = ctypes.create_unicode_buffer("abc")
        self.assertEqual(len(buf), 3+1)

        ctypes.set_conversion_mode("ascii", "replace")
        buf = ctypes.create_unicode_buffer("ab")
        self.assertEqual(buf[:], u"ab\uFFFD\uFFFD\uFFFD\0")
        self.assertEqual(buf[::], u"ab\uFFFD\uFFFD\uFFFD\0")
        self.assertEqual(buf[::-1], u"\0\uFFFD\uFFFD\uFFFDba")
        self.assertEqual(buf[::2], u"a\uFFFD\uFFFD")
        self.assertEqual(buf[6:5:-1], u"")

        ctypes.set_conversion_mode("ascii", "ignore")
        buf = ctypes.create_unicode_buffer("ab")
        # is that correct? not sure.  But with 'ignore', you get what you pay for..
        self.assertEqual(buf[:], u"ab\0\0\0\0")
        self.assertEqual(buf[::], u"ab\0\0\0\0")
        self.assertEqual(buf[::-1], u"\0\0\0\0ba")
        self.assertEqual(buf[::2], u"a\0\0")
        self.assertEqual(buf[6:5:-1], u"")
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_buffers(self):
        ctypes.set_conversion_mode("ascii", "strict")
        buf = ctypes.create_string_buffer(u"abc")
        self.assertEqual(len(buf), 3+1)

        ctypes.set_conversion_mode("ascii", "replace")
        buf = ctypes.create_string_buffer(u"ab")
        self.assertEqual(buf[:], "ab???\0")
        self.assertEqual(buf[::], "ab???\0")
        self.assertEqual(buf[::-1], "\0???ba")
        self.assertEqual(buf[::2], "a??")
        self.assertEqual(buf[6:5:-1], "")

        ctypes.set_conversion_mode("ascii", "ignore")
        buf = ctypes.create_string_buffer(u"ab")
        # is that correct? not sure.  But with 'ignore', you get what you pay for..
        self.assertEqual(buf[:], "ab\0\0\0\0")
        self.assertEqual(buf[::], "ab\0\0\0\0")
        self.assertEqual(buf[::-1], "\0\0\0\0ba")
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_buffers(self):
        ctypes.set_conversion_mode("ascii", "strict")
        buf = ctypes.create_unicode_buffer("abc")
        self.assertEqual(len(buf), 3+1)

        ctypes.set_conversion_mode("ascii", "replace")
        buf = ctypes.create_unicode_buffer("ab")
        self.assertEqual(buf[:], u"ab\uFFFD\uFFFD\uFFFD\0")
        self.assertEqual(buf[::], u"ab\uFFFD\uFFFD\uFFFD\0")
        self.assertEqual(buf[::-1], u"\0\uFFFD\uFFFD\uFFFDba")
        self.assertEqual(buf[::2], u"a\uFFFD\uFFFD")
        self.assertEqual(buf[6:5:-1], u"")

        ctypes.set_conversion_mode("ascii", "ignore")
        buf = ctypes.create_unicode_buffer("ab")
        # is that correct? not sure.  But with 'ignore', you get what you pay for..
        self.assertEqual(buf[:], u"ab\0\0\0\0")
        self.assertEqual(buf[::], u"ab\0\0\0\0")
        self.assertEqual(buf[::-1], u"\0\0\0\0ba")
        self.assertEqual(buf[::2], u"a\0\0")
        self.assertEqual(buf[6:5:-1], u"")
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_buffers(self):
        ctypes.set_conversion_mode("ascii", "strict")
        buf = ctypes.create_string_buffer(u"abc")
        self.assertEqual(len(buf), 3+1)

        ctypes.set_conversion_mode("ascii", "replace")
        buf = ctypes.create_string_buffer(u"ab")
        self.assertEqual(buf[:], "ab???\0")
        self.assertEqual(buf[::], "ab???\0")
        self.assertEqual(buf[::-1], "\0???ba")
        self.assertEqual(buf[::2], "a??")
        self.assertEqual(buf[6:5:-1], "")

        ctypes.set_conversion_mode("ascii", "ignore")
        buf = ctypes.create_string_buffer(u"ab")
        # is that correct? not sure.  But with 'ignore', you get what you pay for..
        self.assertEqual(buf[:], "ab\0\0\0\0")
        self.assertEqual(buf[::], "ab\0\0\0\0")
        self.assertEqual(buf[::-1], "\0\0\0\0ba")
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def test_buffers(self):
        ctypes.set_conversion_mode("ascii", "strict")
        buf = ctypes.create_unicode_buffer("abc")
        self.assertEqual(len(buf), 3+1)

        ctypes.set_conversion_mode("ascii", "replace")
        buf = ctypes.create_unicode_buffer("ab")
        self.assertEqual(buf[:], u"ab\uFFFD\uFFFD\uFFFD\0")
        self.assertEqual(buf[::], u"ab\uFFFD\uFFFD\uFFFD\0")
        self.assertEqual(buf[::-1], u"\0\uFFFD\uFFFD\uFFFDba")
        self.assertEqual(buf[::2], u"a\uFFFD\uFFFD")
        self.assertEqual(buf[6:5:-1], u"")

        ctypes.set_conversion_mode("ascii", "ignore")
        buf = ctypes.create_unicode_buffer("ab")
        # is that correct? not sure.  But with 'ignore', you get what you pay for..
        self.assertEqual(buf[:], u"ab\0\0\0\0")
        self.assertEqual(buf[::], u"ab\0\0\0\0")
        self.assertEqual(buf[::-1], u"\0\0\0\0ba")
        self.assertEqual(buf[::2], u"a\0\0")
        self.assertEqual(buf[6:5:-1], u"")
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def test_buffers(self):
        ctypes.set_conversion_mode("ascii", "strict")
        buf = ctypes.create_string_buffer(u"abc")
        self.assertEqual(len(buf), 3+1)

        ctypes.set_conversion_mode("ascii", "replace")
        buf = ctypes.create_string_buffer(u"ab")
        self.assertEqual(buf[:], "ab???\0")
        self.assertEqual(buf[::], "ab???\0")
        self.assertEqual(buf[::-1], "\0???ba")
        self.assertEqual(buf[::2], "a??")
        self.assertEqual(buf[6:5:-1], "")

        ctypes.set_conversion_mode("ascii", "ignore")
        buf = ctypes.create_string_buffer(u"ab")
        # is that correct? not sure.  But with 'ignore', you get what you pay for..
        self.assertEqual(buf[:], "ab\0\0\0\0")
        self.assertEqual(buf[::], "ab\0\0\0\0")
        self.assertEqual(buf[::-1], "\0\0\0\0ba")
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_buffers(self):
            ctypes.set_conversion_mode("ascii", "strict")
            buf = ctypes.create_unicode_buffer("abc")
            self.assertEqual(len(buf), 3+1)

            ctypes.set_conversion_mode("ascii", "replace")
            buf = ctypes.create_unicode_buffer("ab")
            self.assertEqual(buf[:], u"ab\uFFFD\uFFFD\uFFFD\0")
            self.assertEqual(buf[::], u"ab\uFFFD\uFFFD\uFFFD\0")
            self.assertEqual(buf[::-1], u"\0\uFFFD\uFFFD\uFFFDba")
            self.assertEqual(buf[::2], u"a\uFFFD\uFFFD")
            self.assertEqual(buf[6:5:-1], u"")

            ctypes.set_conversion_mode("ascii", "ignore")
            buf = ctypes.create_unicode_buffer("ab")
            # is that correct? not sure.  But with 'ignore', you get what you pay for..
            self.assertEqual(buf[:], u"ab\0\0\0\0")
            self.assertEqual(buf[::], u"ab\0\0\0\0")
            self.assertEqual(buf[::-1], u"\0\0\0\0ba")
            self.assertEqual(buf[::2], u"a\0\0")
            self.assertEqual(buf[6:5:-1], u"")
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_buffers(self):
            ctypes.set_conversion_mode("ascii", "strict")
            buf = ctypes.create_string_buffer(u"abc")
            self.assertEqual(len(buf), 3+1)

            ctypes.set_conversion_mode("ascii", "replace")
            buf = ctypes.create_string_buffer(u"ab")
            self.assertEqual(buf[:], "ab???\0")
            self.assertEqual(buf[::], "ab???\0")
            self.assertEqual(buf[::-1], "\0???ba")
            self.assertEqual(buf[::2], "a??")
            self.assertEqual(buf[6:5:-1], "")

            ctypes.set_conversion_mode("ascii", "ignore")
            buf = ctypes.create_string_buffer(u"ab")
            # is that correct? not sure.  But with 'ignore', you get what you pay for..
            self.assertEqual(buf[:], "ab\0\0\0\0")
            self.assertEqual(buf[::], "ab\0\0\0\0")
            self.assertEqual(buf[::-1], "\0\0\0\0ba")
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def setUp(self):
        self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def tearDown(self):
        ctypes.set_conversion_mode(*self.prev_conv_mode)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_ascii_strict(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "strict")
        # no conversions take place with unicode arguments
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        # string args are converted
        self.assertEqual(wcslen("abc"), 3)
        self.assertRaises(ctypes.ArgumentError, wcslen, "ab")
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_ascii_replace(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "replace")
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        self.assertEqual(wcslen("abc"), 3)
        self.assertEqual(wcslen("ab"), 3)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_ascii_ignore(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "ignore")
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        # ignore error mode skips non-ascii characters
        self.assertEqual(wcslen("abc"), 3)
        self.assertEqual(wcslen(""), 0)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def setUp(self):
        func = self.func
        self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
        func.argtypes = [ctypes.c_char_p]
        func.restype = ctypes.c_char_p
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def tearDown(self):
        func = self.func
        ctypes.set_conversion_mode(*self.prev_conv_mode)
        func.argtypes = None
        func.restype = ctypes.c_int
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_ascii_replace(self):
        func = self.func
        ctypes.set_conversion_mode("ascii", "strict")
        self.assertEqual(func("abc"), "abc")
        self.assertEqual(func(u"abc"), "abc")
        self.assertRaises(ctypes.ArgumentError, func, u"ab")
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_ascii_ignore(self):
        func = self.func
        ctypes.set_conversion_mode("ascii", "ignore")
        self.assertEqual(func("abc"), "abc")
        self.assertEqual(func(u"abc"), "abc")
        self.assertEqual(func(u""), "")
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def setUp(self):
        self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def tearDown(self):
        ctypes.set_conversion_mode(*self.prev_conv_mode)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_ascii_strict(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "strict")
        # no conversions take place with unicode arguments
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        # string args are converted
        self.assertEqual(wcslen("abc"), 3)
        self.assertRaises(ctypes.ArgumentError, wcslen, "ab")
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_ascii_replace(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "replace")
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        self.assertEqual(wcslen("abc"), 3)
        self.assertEqual(wcslen("ab"), 3)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_ascii_ignore(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "ignore")
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        # ignore error mode skips non-ascii characters
        self.assertEqual(wcslen("abc"), 3)
        self.assertEqual(wcslen(""), 0)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def setUp(self):
        func = self.func
        self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
        func.argtypes = [ctypes.c_char_p]
        func.restype = ctypes.c_char_p
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def tearDown(self):
        func = self.func
        ctypes.set_conversion_mode(*self.prev_conv_mode)
        func.argtypes = None
        func.restype = ctypes.c_int
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_ascii_replace(self):
        func = self.func
        ctypes.set_conversion_mode("ascii", "strict")
        self.assertEqual(func("abc"), "abc")
        self.assertEqual(func(u"abc"), "abc")
        self.assertRaises(ctypes.ArgumentError, func, u"ab")
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_ascii_ignore(self):
        func = self.func
        ctypes.set_conversion_mode("ascii", "ignore")
        self.assertEqual(func("abc"), "abc")
        self.assertEqual(func(u"abc"), "abc")
        self.assertEqual(func(u""), "")
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def setUp(self):
        self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def tearDown(self):
        ctypes.set_conversion_mode(*self.prev_conv_mode)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_ascii_strict(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "strict")
        # no conversions take place with unicode arguments
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        # string args are converted
        self.assertEqual(wcslen("abc"), 3)
        self.assertRaises(ctypes.ArgumentError, wcslen, "ab")
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_ascii_replace(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "replace")
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        self.assertEqual(wcslen("abc"), 3)
        self.assertEqual(wcslen("ab"), 3)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_ascii_ignore(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "ignore")
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        # ignore error mode skips non-ascii characters
        self.assertEqual(wcslen("abc"), 3)
        self.assertEqual(wcslen(""), 0)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def setUp(self):
        func = self.func
        self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
        func.argtypes = [ctypes.c_char_p]
        func.restype = ctypes.c_char_p
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def tearDown(self):
        func = self.func
        ctypes.set_conversion_mode(*self.prev_conv_mode)
        func.argtypes = None
        func.restype = ctypes.c_int
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_ascii_replace(self):
        func = self.func
        ctypes.set_conversion_mode("ascii", "strict")
        self.assertEqual(func("abc"), "abc")
        self.assertEqual(func(u"abc"), "abc")
        self.assertRaises(ctypes.ArgumentError, func, u"ab")
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_ascii_ignore(self):
        func = self.func
        ctypes.set_conversion_mode("ascii", "ignore")
        self.assertEqual(func("abc"), "abc")
        self.assertEqual(func(u"abc"), "abc")
        self.assertEqual(func(u""), "")
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def setUp(self):
        self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def tearDown(self):
        ctypes.set_conversion_mode(*self.prev_conv_mode)
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def test_ascii_strict(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "strict")
        # no conversions take place with unicode arguments
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        # string args are converted
        self.assertEqual(wcslen("abc"), 3)
        self.assertRaises(ctypes.ArgumentError, wcslen, "ab")
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def test_ascii_replace(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "replace")
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        self.assertEqual(wcslen("abc"), 3)
        self.assertEqual(wcslen("ab"), 3)
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def test_ascii_ignore(self):
        wcslen = self.wcslen
        ctypes.set_conversion_mode("ascii", "ignore")
        self.assertEqual(wcslen(u"abc"), 3)
        self.assertEqual(wcslen(u"ab\u2070"), 3)
        # ignore error mode skips non-ascii characters
        self.assertEqual(wcslen("abc"), 3)
        self.assertEqual(wcslen(""), 0)
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def setUp(self):
        func = self.func
        self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
        func.argtypes = [ctypes.c_char_p]
        func.restype = ctypes.c_char_p
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def tearDown(self):
        func = self.func
        ctypes.set_conversion_mode(*self.prev_conv_mode)
        func.argtypes = None
        func.restype = ctypes.c_int
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def test_ascii_replace(self):
        func = self.func
        ctypes.set_conversion_mode("ascii", "strict")
        self.assertEqual(func("abc"), "abc")
        self.assertEqual(func(u"abc"), "abc")
        self.assertRaises(ctypes.ArgumentError, func, u"ab")
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def test_ascii_ignore(self):
        func = self.func
        ctypes.set_conversion_mode("ascii", "ignore")
        self.assertEqual(func("abc"), "abc")
        self.assertEqual(func(u"abc"), "abc")
        self.assertEqual(func(u""), "")
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def setUp(self):
            self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def tearDown(self):
            ctypes.set_conversion_mode(*self.prev_conv_mode)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_ascii_strict(self):
            ctypes.set_conversion_mode("ascii", "strict")
            # no conversions take place with unicode arguments
            self.assertEqual(wcslen(u"abc"), 3)
            self.assertEqual(wcslen(u"ab\u2070"), 3)
            # string args are converted
            self.assertEqual(wcslen("abc"), 3)
            self.assertRaises(ctypes.ArgumentError, wcslen, "ab")
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_ascii_replace(self):
            ctypes.set_conversion_mode("ascii", "replace")
            self.assertEqual(wcslen(u"abc"), 3)
            self.assertEqual(wcslen(u"ab\u2070"), 3)
            self.assertEqual(wcslen("abc"), 3)
            self.assertEqual(wcslen("ab"), 3)